Skip to content

Commit 0bbf8fb

Browse files
yc199911gregkh
authored andcommitted
staging: rtl8723bs: fix fortify warnings by using struct_group
Fix fortify_memcpy_chk warnings in rtw_BIP_verify() and rtw_mgmt_xmitframe_coalesce() functions by using struct_group to access consecutive address fields. Changed memcpy calls to use &hdr->addrs instead of hdr->addr1 when copying 18 bytes (addr1 + addr2 + addr3). This resolves 'detected read beyond size of field' warnings by using the proper struct_group mechanism as suggested by the compiler. Signed-off-by: yingche <zxcv2569763104@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20250829040906.895221-1-zxcv2569763104@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9d78ee4 commit 0bbf8fb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/staging/rtl8723bs/core/rtw_security.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
13631363
ClearPwrMgt(BIP_AAD);
13641364
ClearMData(BIP_AAD);
13651365
/* conscruct AAD, copy address 1 to address 3 */
1366-
memcpy(BIP_AAD+2, pwlanhdr->addr1, 18);
1366+
memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs));
13671367

13681368
if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
13691369
, BIP_AAD, ori_len, mic))

drivers/staging/rtl8723bs/core/rtw_xmit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
12091209
ClearPwrMgt(BIP_AAD);
12101210
ClearMData(BIP_AAD);
12111211
/* conscruct AAD, copy address 1 to address 3 */
1212-
memcpy(BIP_AAD+2, pwlanhdr->addr1, 18);
1212+
memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs));
12131213
/* copy management fram body */
12141214
memcpy(BIP_AAD+BIP_AAD_SIZE, MGMT_body, frame_body_len);
12151215
/* calculate mic */

0 commit comments

Comments
 (0)