[next,1/4] batman-adv: fix alignment for batadv_coded_packet

Message ID 1386013113-25471-1-git-send-email-sw@simonwunderlich.de (mailing list archive)
State Accepted, archived
Commit 08a9dd9a5a9e5b8fb7e984a75096e3c5cd569238
Headers

Commit Message

Simon Wunderlich Dec. 2, 2013, 7:38 p.m. UTC
  The compiler may decide to pad the structure, and then it does not
have the expected size of 46 byte. Fix this by moving it in the
pragma pack(2) part of the code.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 packet.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Marek Lindner Dec. 12, 2013, 5:42 a.m. UTC | #1
On Monday 02 December 2013 20:38:30 Simon Wunderlich wrote:
> The compiler may decide to pad the structure, and then it does not
> have the expected size of 46 byte. Fix this by moving it in the
> pragma pack(2) part of the code.
> 
> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
> ---
>  packet.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied in revision 08a9dd9.

Thanks,
Marek
  

Patch

diff --git a/packet.h b/packet.h
index 207459b..10597a6 100644
--- a/packet.h
+++ b/packet.h
@@ -315,8 +315,6 @@  struct batadv_bcast_packet {
 	 */
 };
 
-#pragma pack()
-
 /**
  * struct batadv_coded_packet - network coded packet
  * @header: common batman packet header and ttl of first included packet
@@ -349,6 +347,8 @@  struct batadv_coded_packet {
 	__be16   coded_len;
 };
 
+#pragma pack()
+
 /**
  * struct batadv_unicast_tvlv - generic unicast packet with tvlv payload
  * @header: common batman packet header