[PATCH] fectest.c: fix buffer overrun

Ralph Siemsen ralph.siemsen at linaro.org
Thu Dec 2 06:45:18 PST 2021


misc-utils/fectest.c:37:11: warning: iteration 47 invokes undefined behavior [-Waggressive-loop-optimizations]
   37 |   srcs[i] = buf + (i * PKT_SIZE);
      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ralph Siemsen <ralph.siemsen at linaro.org>
---
 misc-utils/fectest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-utils/fectest.c b/misc-utils/fectest.c
index fcba513..eb1d33e 100644
--- a/misc-utils/fectest.c
+++ b/misc-utils/fectest.c
@@ -21,7 +21,7 @@ int main(void)
 	unsigned char buf[NR_PKTS * PKT_SIZE];
 	unsigned char pktbuf[(NR_PKTS + DROPS) * PKT_SIZE];
 	struct fec_parms *fec;
-	unsigned char *srcs[NR_PKTS];
+	unsigned char *srcs[NR_PKTS + DROPS];
 	unsigned char *pkt[NR_PKTS + DROPS];
 	int pktnr[NR_PKTS + DROPS];
 	struct timeval then, now;
-- 
2.25.1




More information about the linux-mtd mailing list