wifi: rtw88: 8814a: add __packed to ensure efuse map size
Ping-Ke Shih
maintainerPATCH 1/1 wifi: rtw88: 8814a: add __packed to ensure efuse map size
All nested sture/union used by efuse map should be packed. Otherwise, a arm-linux-gnueabi-gcc compiler might throw errors due to size assertion.
In file included from include/linux/bitfield.h:10,
from include/linux/fortify-string.h:5,
from include/linux/string.h:389,
from include/linux/uuid.h:11,
from include/linux/mod_devicetable.h:14,
from include/linux/usb.h:5,
from drivers/net/wireless/realtek/rtw88/rtw8814a.c:5:Quoted 1 line
Quoted 1 line
include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct rtw8814a_efuse)== 512"
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~~~~~~~~~~~--- drivers/net/wireless/realtek/rtw88/main.h | 2 +- drivers/net/wireless/realtek/rtw88/rtw8814a.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.h +1 -1
@@ -471,7 +471,7 @@ struct rtw_2g_txpwr_idx {struct rtw_2g_ns_pwr_idx_diff ht_2s_diff;struct rtw_2g_ns_pwr_idx_diff ht_3s_diff;struct rtw_2g_ns_pwr_idx_diff ht_4s_diff; -}; +} __packed;struct rtw_5g_ht_1s_pwr_idx_diff {#ifdef __LITTLE_ENDIAN
drivers/net/wireless/realtek/rtw88/rtw8814a.h +1 -1
@@ -51,7 +51,7 @@ struct rtw8814a_efuse {union {struct rtw8814au_efuse u;struct rtw8814ae_efuse e; - }; + } __packed;u8 res5[0x122 ];/* 0xde */ } __packed;
base-commit: 929298742bb5dfacd53ea99cf989cc81210f90a3
Signature · 1 line
2.25.1
Quoted 19 lines · Ping-Ke Shih
All nested sture/union used by efuse map should be packed. Otherwise, a arm-linux-gnueabi-gcc compiler might throw errors due to size assertion.
In file included from
include/linux/bitfield.h:10,from include/linux/fortify-string.h:5, from include/linux/string.h:389, from include/linux/uuid.h:11, from include/linux/mod_devicetable.h:14, from include/linux/usb.h:5, from drivers/net/wireless/realtek/rtw88/rtw8814a.c:5:Quoted 1 line
Quoted 1 line
include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct rtw8814a_efuse)== 512"#define __static_assert(expr, msg, ...) _Static_assert(expr, msg) ^~~~~~~~~~~~~~Fixes 1a7545784642 ("wifi: rtw88: Add rtw8814a.{c,h}")Reported-by kernel test robot <[email protected]>Cc Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
Quoted 5 lines
--- drivers/net/wireless/realtek/rtw88/main.h | 2 +- drivers/net/wireless/realtek/rtw88/rtw8814a.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Thank you for taking care of this. Actually, every chip's efuse struct has a union like this missing __packed, not just RTL8814A. Most of them don't have a static_assert.
Quoted 28 lines
drivers/net/wireless/realtek/rtw88/main.h +1
-1@@ -471,7 +471,7 @@ struct rtw_2g_txpwr_idx {struct rtw_2g_ns_pwr_idx_diff ht_2s_diff;struct rtw_2g_ns_pwr_idx_diff ht_3s_diff;struct rtw_2g_ns_pwr_idx_diff ht_4s_diff; -}; +} __packed;struct rtw_5g_ht_1s_pwr_idx_diff {#ifdef __LITTLE_ENDIANdrivers/net/wireless/realtek/rtw88/rtw8814a.h +1
-1@@ -51,7 +51,7 @@ struct rtw8814a_efuse {union {struct rtw8814au_efuse u;struct rtw8814ae_efuse e; - }; + } __packed;u8 res5[0x122 ];/* 0xde */ } __packed;base-commit:
929298742bb5dfacd53ea99cf989cc81210f90a3
Ping-Ke Shih
maintainerQuoted 26 lines · Bitterblue Smith
Quoted 19 lines · Ping-Ke Shih
All nested sture/union used by efuse map should be packed. Otherwise, a arm-linux-gnueabi-gcc compiler might throw errors due to size assertion.
In file included from
include/linux/bitfield.h:10,
frominclude/linux/fortify-string.h:5, frominclude/linux/string.h:389,
frominclude/linux/uuid.h:11,
frominclude/linux/mod_devicetable.h:14, frominclude/linux/usb.h:5,
fromdrivers/net/wireless/realtek/rtw88/rtw8814a.c:5:Quoted 1 line
Quoted 1 line
include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct rtw8814a_efuse)== 512"#define
__static_assert(expr, msg, ...)_Static_assert(expr, msg)^~~~~~~~~~~~~~Fixes 1a7545784642 ("wifi: rtw88: Add rtw8814a.{c,h}")Reported-by kernel test robot <[email protected]>Cc Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>Quoted 5 lines
---
drivers/net/wireless/realtek/rtw88/main.h | 2 +-drivers/net/wireless/realtek/rtw88/rtw8814a.h| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines
Thank you for taking care of this. Actually, every chip's efuse struct has a union like this missing
__packed, not just RTL8814A. Most of them don't have astatic_assert.
Indeed. I added size assetion of efuse map entirely to rtw88 and rtw89 [1], hoping we can find and address this kind of problem earlier.
[1] https://lore.kernel.org/linux-wireless/[email protected]/T/#t
Ping-Ke Shih
maintainerQuoted 35 lines · Ping-Ke Shih
Quoted 4 lines · Bitterblue Smith
Quoted 3 lines · Ping-Ke Shih
All nested sture/union used by efuse map should be packed. Otherwise, a arm-linux-gnueabi-gcc compiler might throw errors due to size assertion.
Quoted 8 lines
Quoted 8 lines
In file included from
include/linux/bitfield.h:10,
frominclude/linux/fortify-string.h:5, frominclude/linux/string.h:389,
frominclude/linux/uuid.h:11,
frominclude/linux/mod_devicetable.h:14, frominclude/linux/usb.h:5,
fromdrivers/net/wireless/realtek/rtw88/rtw8814a.c:5:Quoted 1 line
Quoted 1 line
include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct rtw8814a_efuse)== 512"
Quoted 14 lines
Quoted 8 lines
#define
__static_assert(expr, msg, ...)_Static_assert(expr, msg)^~~~~~~~~~~~~~Fixes 1a7545784642 ("wifi: rtw88: Add rtw8814a.{c,h}")Reported-by kernel test robot <[email protected]>Cc Bitterblue Smith <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>Quoted 5 lines
---
drivers/net/wireless/realtek/rtw88/main.h | 2 +-drivers/net/wireless/realtek/rtw88/rtw8814a.h| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)Quoted 4 lines
Thank you for taking care of this. Actually, every chip's efuse struct has a union like this missing
__packed, not just RTL8814A. Most of them don't have astatic_assert.
Quoted 5 lines
Indeed. I added size assetion of efuse map entirely to rtw88 and rtw89 [1], hoping we can find and address this kind of problem earlier.
[1] https://lore.kernel.org/linux-wireless/[email protected]/T/#t
As discussion in original link [2], the ARM OABI should not be used anymore. I'd drop this patch, and also drop patches to assert efuse size of rtw88 and rtw89 [1].
[2] https://lore.kernel.org/oe-kbuild-all/[email protected]/