summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-06 17:28:38 -0600
committerTom Rini <[email protected]>2025-11-18 15:53:39 -0600
commit2d226a735e0e9df2c017259c72cfd569986db480 (patch)
tree7981a2d229e554e7b3ed63e183874677a1d5e1f9 /include
parenta70b4f5cae7ebe0e7d9926645635f90994f6257f (diff)
smbios: Fix warning when building with clang
When building with clang, we see warnings such as: error: field max_size within 'struct smbios_type7' is less aligned than 'union cache_size_word' and is usually due to 'struct smbios_type7' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] when building drivers/sysinfo/smbios.c. Resolve this error by packing the unions as well after verifying they are complete (16 or 32 bits). Reviewed-by: Raymond Mao <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Tom Rini <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/smbios.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/smbios.h b/include/smbios.h
index b5fed57aba2..f2f7483bce5 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -204,7 +204,7 @@ struct __packed smbios_type4 {
char eos[SMBIOS_STRUCT_EOS_BYTES];
};
-union cache_config {
+union __packed cache_config {
struct {
u16 level:3;
u16 bsocketed:1;
@@ -217,7 +217,7 @@ union cache_config {
u16 data;
};
-union cache_size_word {
+union __packed cache_size_word {
struct {
u16 size:15;
u16 granu:1;
@@ -225,7 +225,7 @@ union cache_size_word {
u16 data;
};
-union cache_size_dword {
+union __packed cache_size_dword {
struct {
u32 size:31;
u32 granu:1;
@@ -233,7 +233,7 @@ union cache_size_dword {
u32 data;
};
-union cache_sram_type {
+union __packed cache_sram_type {
struct {
u16 other:1;
u16 unknown:1;