[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1381322418-1349-14-git-send-email-antonio@meshcoding.com>
Date: Wed, 9 Oct 2013 14:40:15 +0200
From: Antonio Quartulli <antonio@...hcoding.com>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, b.a.t.m.a.n@...ts.open-mesh.org,
Simon Wunderlich <simon.wunderlich@...03.tu-chemnitz.de>,
Simon Wunderlich <siwu@....tu-chemnitz.de>,
Marek Lindner <lindner_marek@...oo.de>,
Antonio Quartulli <antonio@...hcoding.com>
Subject: [PATCH 13/16] batman-adv: add build check macros for packet member offset
From: Simon Wunderlich <simon.wunderlich@...03.tu-chemnitz.de>
Since we removed the __packed from most of the packets, we should
make sure that the offset generated by the compiler are correct for
sent/received data.
Signed-off-by: Simon Wunderlich <siwu@....tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@...oo.de>
Signed-off-by: Antonio Quartulli <antonio@...hcoding.com>
---
net/batman-adv/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 43dc92e..b22368e 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -393,6 +393,14 @@ static void batadv_recv_handler_init(void)
for (i = 0; i < ARRAY_SIZE(batadv_rx_handler); i++)
batadv_rx_handler[i] = batadv_recv_unhandled_packet;
+ /* compile time checks for struct member offsets */
+ BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10);
+ BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4);
+ BUILD_BUG_ON(offsetof(struct batadv_unicast_frag_packet, dest) != 4);
+ BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4);
+ BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4);
+ BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4);
+
/* batman icmp packet */
batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet;
/* unicast with 4 addresses packet */
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists