davinci_emac: off by one
authorDan Carpenter <error27@gmail.com>
Tue, 2 Mar 2010 21:07:24 +0000 (21:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Mar 2010 09:04:39 +0000 (01:04 -0800)
This off by one error was found by smatch.

drivers/net/davinci_emac.c +2390 emac_dev_open(13) error: buffer overflow 'priv->mac_addr' 6 <= 6

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/davinci_emac.c

index 1ac9440eb3fb2daa6bf1c035d36dc37fb459279c..32960b9b02ae0ba96b539d88cddda617125e8da0 100644 (file)
@@ -2385,7 +2385,7 @@ static int emac_dev_open(struct net_device *ndev)
        struct emac_priv *priv = netdev_priv(ndev);
 
        netif_carrier_off(ndev);
-       for (cnt = 0; cnt <= ETH_ALEN; cnt++)
+       for (cnt = 0; cnt < ETH_ALEN; cnt++)
                ndev->dev_addr[cnt] = priv->mac_addr[cnt];
 
        /* Configuration items */