lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 10 Oct 2013 09:37:32 +0100
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Antonio Quartulli" <antonio@...hcoding.com>, <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>
Subject: RE: [PATCH 13/16] batman-adv: add build check macros for packet member offset

> 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.
...
> +	/* 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);

It is usually enough to check the size of the structures.
Which is also best done in the .h file so it is validated
in all the compilation environments that might be used.

	David



--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ