* [PATCH] drivers/net/cpmac.c: Correct code taking the size of a pointer
@ 2009-12-13 15:35 Julia Lawall
2009-12-14 3:57 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-12-13 15:35 UTC (permalink / raw)
To: florian, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
sizeof(dev->dev_addr) is the size of a pointer. On the other hand,
sizeof(pdata->dev_addr) is the size of an array, so use that instead.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression *x;
expression f;
type T;
@@
*f(...,(T)x,...)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/cpmac.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 6782223..8d0be26 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -1163,7 +1163,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
priv->dev = dev;
priv->ring_size = 64;
priv->msg_enable = netif_msg_init(debug_level, 0xff);
- memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
+ memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr));
snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/net/cpmac.c: Correct code taking the size of a pointer
2009-12-13 15:35 [PATCH] drivers/net/cpmac.c: Correct code taking the size of a pointer Julia Lawall
@ 2009-12-14 3:57 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-12-14 3:57 UTC (permalink / raw)
To: julia; +Cc: florian, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Date: Sun, 13 Dec 2009 16:35:45 +0100 (CET)
> From: Julia Lawall <julia@diku.dk>
>
> sizeof(dev->dev_addr) is the size of a pointer. On the other hand,
> sizeof(pdata->dev_addr) is the size of an array, so use that instead.
>
> A simplified version of the semantic patch that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
...
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-14 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-13 15:35 [PATCH] drivers/net/cpmac.c: Correct code taking the size of a pointer Julia Lawall
2009-12-14 3:57 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®