> 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



Reply via email to