Message ID | 1412348517-20352-4-git-send-email-antoine.tenart@free-electrons.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Friday 03 October 2014 17:01:56 Antoine Tenart wrote: > 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> > It's probably worth mentioning here that this cannot happen in this driver because it's only used in one powerpc-specific chip, and 'char' is always 'unsigned' on powerpc. Arnd -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Arnd, On Fri, Oct 03, 2014 at 05:15:05PM +0200, Arnd Bergmann wrote: > On Friday 03 October 2014 17:01:56 Antoine Tenart wrote: > > 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> > > > > It's probably worth mentioning here that this cannot happen in this > driver because it's only used in one powerpc-specific chip, and 'char' > is always 'unsigned' on powerpc. Oh, that's good to know :) Antoine
diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index 713313e15c68..8e9371a3388a 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c @@ -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);
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> --- drivers/net/ethernet/toshiba/spider_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)