Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2447f2f3 authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller
Browse files

drivers/net/cpmac.c: Correct code taking the size of a pointer

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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 94de803d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);