[ovs-dev] [PATCH] openvswitch: Fix alignment of struct sw_flow_key.
Geert Uytterhoeven
geert at linux-m68k.org
Thu Sep 5 19:25:20 UTC 2013
On Thu, Sep 5, 2013 at 9:17 PM, Jesse Gross <jesse at nicira.com> wrote:
> --- a/net/openvswitch/flow.c
> +++ b/net/openvswitch/flow.c
> @@ -1981,6 +1981,7 @@ nla_put_failure:
> * Returns zero if successful or a negative error code. */
> int ovs_flow_init(void)
> {
> + BUILD_BUG_ON(__alignof__(struct sw_flow_key) % __alignof__(long));
> -} __aligned(__alignof__(long));
> +} __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */
These don't match: the struct definition says aligned to 4 or 8 bytes, the check
checks for a multiple of the alignment of "long", which is 2, 4 or 8.
Anyway, BITS_PER_LONG/8 is always a multiple of __alignof__(long), so your
check will never fail.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
More information about the dev
mailing list