Skip to content

Commit

Permalink
drivers/net/usb: Correct code taking the size of a pointer
Browse files Browse the repository at this point in the history
sizeof(dev->dev_addr) is the size of a pointer.  A few lines above, the
size of this field is obtained using netdev->addr_len for a call to memcpy,
so do the same here.

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Dec 14, 2009
1 parent 2447f2f commit 6057912
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/usb/rtl8150.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
dbg("%02X:", netdev->dev_addr[i]);
dbg("%02X\n", netdev->dev_addr[i]);
/* Set the IDR registers. */
set_registers(dev, IDR, sizeof(netdev->dev_addr), netdev->dev_addr);
set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr);
#ifdef EEPROM_WRITE
{
u8 cr;
Expand Down

0 comments on commit 6057912

Please sign in to comment.