* [PATCH] wifi: mt76: fix coverity uninit_use_in_call in mt76_connac2_reverse_frag0_hdr_trans()
@ 2022-12-07 9:22 Deren Wu
2022-12-07 13:17 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 3+ messages in thread
From: Deren Wu @ 2022-12-07 9:22 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang,
Deren Wu, KM Lin, Robin Chiu, CH Yeh, Posh Sun, Stella Chang,
Evelyn Tsai, Ryder Lee, Shayne Chen, linux-wireless,
linux-mediatek, Deren Wu
The default case for frame_contorl is invalid. We should always
assign addr3 of this frame properly.
Coverity error message:
if (ieee80211_has_a4(hdr.frame_control))
(19) Event uninit_use_in_call: Using uninitialized value "hdr".
Field "hdr.addr3" is uninitialized when calling "memcpy".
memcpy(skb_push(skb, sizeof(hdr)), &hdr, sizeof(hdr));
else
memcpy(skb_push(skb, sizeof(hdr) - 6), &hdr, sizeof(hdr) - 6);
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
index fd60123fb284..c8d0c84e688b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
@@ -930,7 +930,7 @@ int mt76_connac2_reverse_frag0_hdr_trans(struct ieee80211_vif *vif,
ether_addr_copy(hdr.addr4, eth_hdr->h_source);
break;
default:
- break;
+ return -EINVAL;
}
skb_pull(skb, hdr_offset + sizeof(struct ethhdr) - 2);
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: mt76: fix coverity uninit_use_in_call in mt76_connac2_reverse_frag0_hdr_trans()
2022-12-07 9:22 [PATCH] wifi: mt76: fix coverity uninit_use_in_call in mt76_connac2_reverse_frag0_hdr_trans() Deren Wu
@ 2022-12-07 13:17 ` AngeloGioacchino Del Regno
2022-12-07 15:31 ` Deren Wu (武德仁)
0 siblings, 1 reply; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-12-07 13:17 UTC (permalink / raw)
To: Deren Wu, Felix Fietkau, Lorenzo Bianconi
Cc: Sean Wang, Soul Huang, YN Chen, Leon Yen, Eric-SY Chang, KM Lin,
Robin Chiu, CH Yeh, Posh Sun, Stella Chang, Evelyn Tsai,
Ryder Lee, Shayne Chen, linux-wireless, linux-mediatek
Il 07/12/22 10:22, Deren Wu ha scritto:
> The default case for frame_contorl is invalid. We should always
> assign addr3 of this frame properly.
>
> Coverity error message:
> if (ieee80211_has_a4(hdr.frame_control))
> (19) Event uninit_use_in_call: Using uninitialized value "hdr".
> Field "hdr.addr3" is uninitialized when calling "memcpy".
> memcpy(skb_push(skb, sizeof(hdr)), &hdr, sizeof(hdr));
> else
> memcpy(skb_push(skb, sizeof(hdr) - 6), &hdr, sizeof(hdr) - 6);
>
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Please add the appropriate Fixes tag to this commit.
Thanks,
Angelo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: mt76: fix coverity uninit_use_in_call in mt76_connac2_reverse_frag0_hdr_trans()
2022-12-07 13:17 ` AngeloGioacchino Del Regno
@ 2022-12-07 15:31 ` Deren Wu (武德仁)
0 siblings, 0 replies; 3+ messages in thread
From: Deren Wu (武德仁) @ 2022-12-07 15:31 UTC (permalink / raw)
To: nbd, angelogioacchino.delregno, lorenzo
Cc: Evelyn Tsai (蔡珊鈺),
linux-mediatek, Leon Yen (顏良儒),
Shayne Chen (陳軒丞),
Stella Chang (張曉佩),
Sean Wang, KM Lin (林昆民),
Soul Huang (黃至昶),
YN Chen (陳彥寧),
Posh Sun (孫瑞廷),
Eric-SY Chang (張書源),
CH Yeh (葉志豪),
Robin Chiu (邱國濱),
Ryder Lee, linux-wireless
On Wed, 2022-12-07 at 14:17 +0100, AngeloGioacchino Del Regno wrote:
> Il 07/12/22 10:22, Deren Wu ha scritto:
> > The default case for frame_contorl is invalid. We should always
> > assign addr3 of this frame properly.
> >
> > Coverity error message:
> > if (ieee80211_has_a4(hdr.frame_control))
> > (19) Event uninit_use_in_call: Using uninitialized value
> > "hdr".
> > Field "hdr.addr3" is uninitialized when calling "memcpy".
> > memcpy(skb_push(skb, sizeof(hdr)), &hdr, sizeof(hdr));
> > else
> > memcpy(skb_push(skb, sizeof(hdr) - 6), &hdr, sizeof(hdr) - 6);
> >
> > Signed-off-by: Deren Wu <deren.wu@mediatek.com>
>
> Please add the appropriate Fixes tag to this commit.
>
> Thanks,
> Angelo
>
Thanks, Angelo. I will post a new version with Fixes tag.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-07 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 9:22 [PATCH] wifi: mt76: fix coverity uninit_use_in_call in mt76_connac2_reverse_frag0_hdr_trans() Deren Wu
2022-12-07 13:17 ` AngeloGioacchino Del Regno
2022-12-07 15:31 ` Deren Wu (武德仁)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).