Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <linux/stddef.h> in basic_types.h to ensure offsetof()
is available for this and future conversions.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20251125112059.16913-3-knavaneeth786@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Navaneeth K and committed by
Greg Kroah-Hartman
6ddb173f e09748f8

+3 -1
+1
drivers/staging/rtl8723bs/include/basic_types.h
··· 12 12 #define FAIL (-1) 13 13 14 14 #include <linux/types.h> 15 + #include <linux/stddef.h> 15 16 16 17 #define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s *)(0))->field) 17 18
+2 -1
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
··· 1712 1712 1713 1713 if (wep_key_len > 0) { 1714 1714 wep_key_len = wep_key_len <= 5 ? 5 : 13; 1715 - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); 1715 + wep_total_len = wep_key_len + 1716 + offsetof(struct ndis_802_11_wep, key_material); 1716 1717 pwep = rtw_malloc(wep_total_len); 1717 1718 if (!pwep) { 1718 1719 ret = -ENOMEM;