Skip to content

Commit ca76817

Browse files
Ping-Ke ShihKalle Valo
authored andcommitted
wifi: rtw89: coex: use struct assignment to replace memcpy() to append TDMA content
To notify firmware TDMA timeslot assignment, append TDMA parameters when sending policy H2C firmware command. However, compiler warns we do memcpy() data to val[] field of TLV struct. To avoid this, assign the struct value with simple '=' instead. Compile tested only. rtw89/coex.c: In function '_append_tdma': drivers/net/wireless/realtek/rtw89/coex.c:1585:17: warning: writing 8 bytes into a region of size 0 [-Wstringop-overflow=] 1585 | memcpy(&v3->tdma, &dm->tdma, sizeof(v3->tdma)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/net/wireless/realtek/rtw89/coex.h:8, from drivers/net/wireless/realtek/rtw89/coex.c:5: drivers/net/wireless/realtek/rtw89/core.h:2703:37: note: at offset [5714, 71249] into destination object 'ver' of size 8 2703 | const struct rtw89_btc_ver *ver; | ^~~ drivers/net/wireless/realtek/rtw89/coex.c:1579:17: warning: writing 8 bytes into a region of size 0 [-Wstringop-overflow=] 1579 | memcpy(v, &dm->tdma, sizeof(*v)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/realtek/rtw89/core.h:2703:37: note: at offset [5710, 71245] into destination object 'ver' of size 8 2703 | const struct rtw89_btc_ver *ver; | ^~~ Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Ping-Ke Shih <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5cb0d6b commit ca76817

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/wireless/realtek/rtw89

1 file changed

+2
-2
lines changed

drivers/net/wireless/realtek/rtw89/coex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,13 +1576,13 @@ static void _append_tdma(struct rtw89_dev *rtwdev)
15761576
if (ver->fcxtdma == 1) {
15771577
v = (struct rtw89_btc_fbtc_tdma *)&tlv->val[0];
15781578
tlv->len = sizeof(*v);
1579-
memcpy(v, &dm->tdma, sizeof(*v));
1579+
*v = dm->tdma;
15801580
btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v);
15811581
} else {
15821582
tlv->len = sizeof(*v3);
15831583
v3 = (struct rtw89_btc_fbtc_tdma_v3 *)&tlv->val[0];
15841584
v3->fver = ver->fcxtdma;
1585-
memcpy(&v3->tdma, &dm->tdma, sizeof(v3->tdma));
1585+
v3->tdma = dm->tdma;
15861586
btc->policy_len += BTC_TLV_HDR_LEN + sizeof(*v3);
15871587
}
15881588

0 commit comments

Comments
 (0)