Skip to content

Commit 6ddb173

Browse files
cyberkunjugregkh
authored andcommitted
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>
1 parent e09748f commit 6ddb173

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/staging/rtl8723bs/include/basic_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define FAIL (-1)
1313

1414
#include <linux/types.h>
15+
#include <linux/stddef.h>
1516

1617
#define FIELD_OFFSET(s, field) ((__kernel_ssize_t)&((s *)(0))->field)
1718

drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
17121712

17131713
if (wep_key_len > 0) {
17141714
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);
17161717
pwep = rtw_malloc(wep_total_len);
17171718
if (!pwep) {
17181719
ret = -ENOMEM;

0 commit comments

Comments
 (0)