From fbdd4dff3660de875ece3cd28fe1211967d00bb1 Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Fri, 19 Feb 2016 19:07:02 +0800 Subject: [PATCH] fm10k/base: fix TLV structures alignment Per comments from an upstream kernel patch, and looking at how TLV LE_STRUCT code works, we actually want these structures to be 4byte aligned, not 1byte aligned. In practice, 1byte alignment has worked so far because all our structures end up being a multiple of 4. But if a future TLV structure were added that had a u8 or similar sticking on the end things would break. Fix this by using 4byte alignment which will prevent the TLV LE_STRUCT code from breaking. Update the comment explaining that we need 4byte alignment of our structures. Fixes: 925c862cbc21 ("fm10k/base: pack TLV overlay structures") Signed-off-by: Wang Xiao W Tested-by: Heng Ding Acked-by: Jing Chen --- drivers/net/fm10k/base/fm10k_pf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h index 92e29626af..ee8527af05 100644 --- a/drivers/net/fm10k/base/fm10k_pf.h +++ b/drivers/net/fm10k/base/fm10k_pf.h @@ -91,14 +91,14 @@ enum fm10k_pf_tlv_attr_id_v1 { #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16 -/* The following data structures are overlayed specifically to TLV mailbox - * messages, and must not have gaps between their values. They must line up - * correctly to the TLV definition. +/* The following data structures are overlayed directly onto TLV mailbox + * messages, and must not break 4 byte alignment. Ensure the structures line + * up correctly as per their TLV definition. */ #ifdef C99 -#pragma pack(push, 1) +#pragma pack(push, 4) #else -#pragma pack(1) +#pragma pack(4) #endif /* C99 */ struct fm10k_mac_update { -- 2.20.1