net: spider_net: avoid using signed char for bitops
authorAntoine Ténart <antoine.tenart@free-electrons.com>
Fri, 3 Oct 2014 15:01:56 +0000 (17:01 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Oct 2014 01:15:16 +0000 (21:15 -0400)
Signedness bugs may occur when using signed char for bitops,
depending on if the highest bit is ever used.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/toshiba/spider_net.c

index 713313e15c68b531838ab98e5614dc3f7d794a1f..8e9371a3388a00ed78043c1d098b8c31db776ea7 100644 (file)
@@ -1325,9 +1325,9 @@ spider_net_set_mac(struct net_device *netdev, void *p)
        spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue);
 
        /* write mac */
-       macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) +
-               (addr->sa_data[2]<<8) + (addr->sa_data[3]);
-       macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]);
+       macu = (netdev->dev_addr[0]<<24) + (netdev->dev_addr[1]<<16) +
+               (netdev->dev_addr[2]<<8) + (netdev->dev_addr[3]);
+       macl = (netdev->dev_addr[4]<<8) + (netdev->dev_addr[5]);
        spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu);
        spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl);