From 6ddb173fcf34f4b9351a20f29e31aa2bc3f90574 Mon Sep 17 00:00:00 2001 From: Navaneeth K Date: Tue, 25 Nov 2025 11:20:56 +0000 Subject: [PATCH] staging: rtl8723bs: use standard offsetof in cfg80211 operations Replace usage of the custom FIELD_OFFSET macro with the standard offsetof() macro in ioctl_cfg80211.c. This improves code readability and uses the kernel's standard mechanism. Also include in basic_types.h to ensure offsetof() is available for this and future conversions. Signed-off-by: Navaneeth K Reviewed-by: Dan Carpenter Link: https://patch.msgid.link/20251125112059.16913-3-knavaneeth786@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/basic_types.h | 1 + drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h index 1c2da18e62100..16b270fe0203d 100644 --- a/drivers/staging/rtl8723bs/include/basic_types.h +++ b/drivers/staging/rtl8723bs/include/basic_types.h @@ -12,6 +12,7 @@ #define FAIL (-1) #include +#include #define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s *)(0))->field) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 315bab3737294..60edeae1cffe7 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -1712,7 +1712,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); + wep_total_len = wep_key_len + + offsetof(struct ndis_802_11_wep, key_material); pwep = rtw_malloc(wep_total_len); if (!pwep) { ret = -ENOMEM; -- 2.47.3