]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
openvswitch: Fix alignment of struct sw_flow_key.
authorJesse Gross <jesse@nicira.com>
Thu, 5 Sep 2013 19:17:05 +0000 (12:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Sep 2013 19:54:37 +0000 (15:54 -0400)
sw_flow_key alignment was declared as " __aligned(__alignof__(long))".
However, this breaks on the m68k architecture where long is 32 bit in
size but 16 bit aligned by default. This aligns to the size of a long to
ensure that we can always do comparsions in full long-sized chunks. It
also adds an additional build check to catch any reduction in alignment.

CC: Andy Zhou <azhou@nicira.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/flow.c
net/openvswitch/flow.h

index ad1aeeb4f373f2702a91b4478174a0a046ee3ab7..fb36f856516112045c767f02a7f561da2a85d086 100644 (file)
@@ -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));
        BUILD_BUG_ON(sizeof(struct sw_flow_key) % sizeof(long));
 
        flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow), 0,
index b65f885ac3dcc59468235d4aa4d64a6d047b406c..212fbf7510c42d02dc13915024839843ba498c96 100644 (file)
@@ -125,7 +125,7 @@ struct sw_flow_key {
                        } nd;
                } ipv6;
        };
-} __aligned(__alignof__(long));
+} __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */
 
 struct sw_flow {
        struct rcu_head rcu;