tulip_core.c : out-of-bounds check.
authorAmeen Ali <ameenali023@gmail.com>
Fri, 13 Mar 2015 14:15:52 +0000 (16:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Mar 2015 16:43:25 +0000 (12:43 -0400)
Array index 'j' is used before limits check.

Suggest put limit check before index use.

Signed-off-by : <Ameenali023@gmail.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/dec/tulip/tulip_core.c

index 3b42556f7f8d66929f1435445df06072c65ae6aa..ed41559bae771b8d58e49f21a46f7a79d9f20cac 100644 (file)
@@ -589,7 +589,7 @@ static void tulip_tx_timeout(struct net_device *dev)
                               (unsigned int)tp->rx_ring[i].buffer1,
                               (unsigned int)tp->rx_ring[i].buffer2,
                               buf[0], buf[1], buf[2]);
-                       for (j = 0; buf[j] != 0xee && j < 1600; j++)
+                       for (j = 0; ((j < 1600) && buf[j] != 0xee); j++)
                                if (j < 100)
                                        pr_cont(" %02x", buf[j]);
                        pr_cont(" j=%d\n", j);