From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: net: pxa168_eth: set the mac address on the Ethernet controller
Date: Wed, 01 Oct 2014 16:54:02 +0000 [thread overview]
Message-ID: <20141001165402.GB16843@mwanda> (raw)
Hello Antoine Ténart,
The patch 39830689ef0a: "net: pxa168_eth: set the mac address on the
Ethernet controller" from Sep 30, 2014, leads to the following static
checker warning:
drivers/net/ethernet/marvell/pxa168_eth.c:640 pxa168_eth_set_mac_address()
warn: using signed char for bitops
drivers/net/ethernet/marvell/pxa168_eth.c
625 static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr)
626 {
627 struct sockaddr *sa = addr;
628 struct pxa168_eth_private *pep = netdev_priv(dev);
629 unsigned char oldMac[ETH_ALEN];
630 u32 mac_h, mac_l;
631
632 if (!is_valid_ether_addr(sa->sa_data))
633 return -EADDRNOTAVAIL;
634 memcpy(oldMac, dev->dev_addr, ETH_ALEN);
635 memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
636
637 mac_h = sa->sa_data[0] << 24;
638 mac_h |= sa->sa_data[1] << 16;
639 mac_h |= sa->sa_data[2] << 8;
640 mac_h |= sa->sa_data[3];
You may end up with weird signedness bugs doing this (depending of if
the highest bit is ever used).
641 mac_l = sa->sa_data[4] << 8;
642 mac_l |= sa->sa_data[5];
643 wrl(pep, MAC_ADDR_HIGH, mac_h);
644 wrl(pep, MAC_ADDR_LOW, mac_l);
645
646 netif_addr_lock_bh(dev);
647 update_hash_table_mac_address(pep, oldMac, dev->dev_addr);
648 netif_addr_unlock_bh(dev);
649 return 0;
650 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2014-10-01 16:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 16:54 Dan Carpenter [this message]
2014-10-03 13:40 ` net: pxa168_eth: set the mac address on the Ethernet controller Antoine Tenart
2014-10-03 13:55 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141001165402.GB16843@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox