Skip to content

Commit f495027

Browse files
nathanchancegregkh
authored andcommitted
wifi: mt76: mt7996: Initialize hdr before passing to skb_put_data()
commit 87b07a1 upstream. A new warning in clang [1] points out a couple of places where a hdr variable is not initialized then passed along to skb_put_data(). drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:1894:21: warning: variable 'hdr' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] 1894 | skb_put_data(skb, &hdr, sizeof(hdr)); | ^~~ drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:3386:21: warning: variable 'hdr' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] 3386 | skb_put_data(skb, &hdr, sizeof(hdr)); | ^~~ Zero initialize these headers as done in other places in the driver when there is nothing stored in the header. Cc: stable@vger.kernel.org Fixes: 98686cd ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Link: llvm/llvm-project@00dacf8 [1] Closes: ClangBuiltLinux/linux#2104 Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20250715-mt7996-fix-uninit-const-pointer-v1-1-b5d8d11d7b78@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c6dbd5b commit f495027

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7996

1 file changed

+2
-2
lines changed

drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,8 +1879,8 @@ mt7996_mcu_get_mmps_mode(enum ieee80211_smps_mode smps)
18791879
int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
18801880
void *data, u16 version)
18811881
{
1882+
struct uni_header hdr = {};
18821883
struct ra_fixed_rate *req;
1883-
struct uni_header hdr;
18841884
struct sk_buff *skb;
18851885
struct tlv *tlv;
18861886
int len;
@@ -3377,7 +3377,7 @@ int mt7996_mcu_set_hdr_trans(struct mt7996_dev *dev, bool hdr_trans)
33773377
{
33783378
struct {
33793379
u8 __rsv[4];
3380-
} __packed hdr;
3380+
} __packed hdr = {};
33813381
struct hdr_trans_blacklist *req_blacklist;
33823382
struct hdr_trans_en *req_en;
33833383
struct sk_buff *skb;

0 commit comments

Comments
 (0)