[ipxe-devel] util/nrv2b.c:633:17: error: array subscript is above array bounds
Joshua C.
joshuacov at googlemail.com
Tue Apr 24 18:34:44 UTC 2012
2012/4/11 Ján ONDREJ (SAL) <ondrejj at salstar.sk>:
> Hello,
>
> compiling today's git fails with this error:
>
> [ondrejj at work src]$ make
> [HOSTCC] util/zbin
> [LD] bin/ipxe.dsk.tmp
> In file included from util/zbin.c:6:0:
> util/nrv2b.c: In function ‘find_match’:
> util/nrv2b.c:633:17: error: array subscript is above array bounds
> [-Werror=array-bounds]
> util/nrv2b.c:634:14: error: array subscript is above array bounds
> [-Werror=array-bounds]
> cc1: all warnings being treated as errors
> make: *** [util/zbin] Error 1
> make: *** Waiting for unfinished jobs....
>
> Suggested change from meteger on IRC helped to solve this problem.
>
> [19:54] <meteger:#ipxe> SALstar: open util/nrv2b.c, go to line 212, and
> change the "#define SWD_BEST_OFF 1" to "#define SWD_BEST_OFF 3"
>
> SAL
> _______________________________________________
> ipxe-devel mailing list
> ipxe-devel at lists.ipxe.org
> https://lists.ipxe.org/mailman/listinfo/ipxe-devel
I patched it like this to temporary solve the problem:
---
util/nrv2b.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/nrv2b.c b/util/nrv2b.c
index cbb94c0..b7f9be1 100644
--- a/util/nrv2b.c
+++ b/util/nrv2b.c
@@ -629,7 +629,7 @@ static int swd_search2(struct ucl_swd *s)
s->b[s->bp], s->b[s->bp+1], s->b[key], s->b[key+1]);
#endif
assert(memcmp(&s->b[s->bp],&s->b[key],2) == 0);
-#if defined(SWD_BEST_OFF)
+#if defined(SWD_BEST_OFF) && (SWD_BEST_OFF >= 2)
if (s->best_pos[2] == 0)
s->best_pos[2] = key + 1;
#endif
--
1.7.10
--
--
-- joshua
More information about the ipxe-devel
mailing list