* [patch] davinci_emac: off by one
@ 2010-03-03 7:07 Dan Carpenter
2010-03-03 9:08 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-03 7:07 UTC (permalink / raw)
To: netdev
Cc: Chaithrika U S, Sriramakrishnan, David S. Miller, Kevin Hilman,
Anant Gole, kernel-janitors
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>
---
I don't have the hardware to test this. If would be cool if someone
would verify that the hardware still works after the patch is applied.
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 1605bc2..eab07cd 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2386,7 +2386,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 */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] davinci_emac: off by one
2010-03-03 7:07 [patch] davinci_emac: off by one Dan Carpenter
@ 2010-03-03 9:08 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-03-03 9:08 UTC (permalink / raw)
To: error27; +Cc: netdev, chaithrika, srk, khilman, anantgole, kernel-janitors
From: Dan Carpenter <error27@gmail.com>
Date: Wed, 3 Mar 2010 10:07:24 +0300
> 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>
> ---
> I don't have the hardware to test this. If would be cool if someone
> would verify that the hardware still works after the patch is applied.
It looks obvious enough for me, taking in more than 6 address
bytes make no sense in an ethernet driver, so I'll apply this.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-03 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03 7:07 [patch] davinci_emac: off by one Dan Carpenter
2010-03-03 9:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).