[PATCH 14/25] common/idpf: avoid compiler padding
Soumyadeep Hore
soumyadeep.hore at intel.com
Tue May 28 09:35:54 CEST 2024
In the arm random config file, kconfig option 'CONFIG_AEABI' is
disabled which results in adding the compiler flag '-mabi=apcs-gnu'.
This causes the compiler to add padding in virtchnl2_ptype
structure to align it to 8 bytes, resulting in size check failure.
Avoid the compiler padding by using "__packed" structure
attribute for the virtchnl2_ptype struct. Also align the
structure by using "__aligned(2)" for better code optimization.
Signed-off-by: Soumyadeep Hore <soumyadeep.hore at intel.com>
---
drivers/common/idpf/base/virtchnl2.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h
index 95fca647b1..aadb2aafff 100644
--- a/drivers/common/idpf/base/virtchnl2.h
+++ b/drivers/common/idpf/base/virtchnl2.h
@@ -1454,7 +1454,11 @@ struct virtchnl2_ptype {
u8 proto_id_count;
__le16 pad;
__le16 proto_id[STRUCT_VAR_LEN];
+#ifdef FLEX_ARRAY_SUPPORT
+} __packed __aligned(2);
+#else
};
+#endif /* FLEX_ARRAY_SUPPORT */
VIRTCHNL2_CHECK_STRUCT_VAR_LEN(8, virtchnl2_ptype, proto_id);
/**
--
2.43.0
More information about the dev
mailing list