Skip to contentSkip to conversation

net: cfg802154: mark ieee802154_addr as packed

PATCH In review Alexander Aring 1 participant 2 messages Apr 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: cfg802154: mark ieee802154_addr as packed

This patch marks ieee802154_addr as packed as it used by memcmp to compare this struct for rhashtable in fragmentation api.

Fixes 648700f76b03 ("inet: frags: use rhashtables for reassembly units")
---
 include/net/cfg802154.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/cfg802154.h +1 -1
index 795ca4008f72..fc5dab9c798e 100644
@@ -242,7 +242,7 @@ struct ieee802154_addr {
 		__le16 short_addr;
 		__le64 extended_addr;
 	};
-};
+} __packed;
 
 struct ieee802154_llsec_key_id {
 	u8 mode;
Signature · 1 line
2.11.0
#1 lore raw

Hi,

Quoted 15 lines · Alexander Aring

This patch marks ieee802154_addr as packed as it used by memcmp to compare this struct for rhashtable in fragmentation api.

Fixes 648700f76b03 ("inet: frags: use rhashtables for reassembly units")
---
 include/net/cfg802154.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/cfg802154.h +0 -0
index 795ca4008f72..fc5dab9c798e 100644

include/net/cfg802154.h struct ieee802154_addr { · line 246

Quoted 6 lines
include/net/cfg802154.h +1 -1
@@ -242,7 +242,7 @@ struct ieee802154_addr {
                __le16 short_addr;
                __le64 extended_addr;
        };
-};
+} __packed;
 

Stefan drop this one, it was somehow to fix my issue at first... but its not the real solution.
I just did a hexdump on the key and saw that the length doesn't fit what sizeof tells me so I did that and was too happy that it worked.

The real fix would be to figure out why I have some "random" bits in this structure... something need to have memset to zero before... I need to check, so far I see it only in FRAG1 I guess it's related to uncompression...

This fix will work so far... but you will get issues in short address handling which will be filled with more padding bytes and this should be zero, so it's all the same...

Sorry.

- Alex