summaryrefslogtreecommitdiffstats
path: root/net/ieee802154/af_ieee802154.c
diff options
context:
space:
mode:
authorPhoebe Buckheister2014-03-14 21:23:59 +0100
committerDavid S. Miller2014-03-15 03:15:26 +0100
commitb70ab2e87f17176d18f67ef331064441a032b5f3 (patch)
tree634b1482ab909ebe4d62b2a786378ad9584f922a /net/ieee802154/af_ieee802154.c
parentieee802154: add address struct with proper endiannes and some operations (diff)
downloadkernel-qcow2-linux-b70ab2e87f17176d18f67ef331064441a032b5f3.tar.gz
kernel-qcow2-linux-b70ab2e87f17176d18f67ef331064441a032b5f3.tar.xz
kernel-qcow2-linux-b70ab2e87f17176d18f67ef331064441a032b5f3.zip
ieee802154: enforce consistent endianness in the 802.15.4 stack
Enable sparse warnings about endianness, replace the remaining fields regarding network operations without explicit endianness annotations with such that are annotated, and propagate this through the entire stack. Uses of ieee802154_addr_sa are not changed yet, this patch is only concerned with all other fields (such as address filters, operation parameters and the likes). Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154/af_ieee802154.c')
-rw-r--r--net/ieee802154/af_ieee802154.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index a8db341581ac..973cb11da42b 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -48,7 +48,7 @@ struct net_device *ieee802154_get_dev(struct net *net,
{
struct net_device *dev = NULL;
struct net_device *tmp;
- u16 pan_id, short_addr;
+ __le16 pan_id, short_addr;
switch (addr->addr_type) {
case IEEE802154_ADDR_LONG:
@@ -59,9 +59,9 @@ struct net_device *ieee802154_get_dev(struct net *net,
rcu_read_unlock();
break;
case IEEE802154_ADDR_SHORT:
- if (addr->pan_id == 0xffff ||
+ if (addr->pan_id == IEEE802154_PANID_BROADCAST ||
addr->short_addr == IEEE802154_ADDR_UNDEF ||
- addr->short_addr == 0xffff)
+ addr->short_addr == IEEE802154_ADDR_UNDEF)
break;
rtnl_lock();
@@ -74,8 +74,8 @@ struct net_device *ieee802154_get_dev(struct net *net,
short_addr =
ieee802154_mlme_ops(tmp)->get_short_addr(tmp);
- if (pan_id == addr->pan_id &&
- short_addr == addr->short_addr) {
+ if (le16_to_cpu(pan_id) == addr->pan_id &&
+ le16_to_cpu(short_addr) == addr->short_addr) {
dev = tmp;
dev_hold(dev);
break;