Skip to contentSkip to conversation

ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl

PATCH In review Nathan Chancellor 3 participants 6 messages Jan 30, 2020 – Mar 17, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl

Clang warns a few times (trimmed for brevity):

../drivers/net/wireless/ath/ath11k/debugfs_sta.c:185:7: warning:
variable 'rate_idx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

It is not wrong, rate_idx is only initialized in the first if block. However, this is not necessarily an issue in practice because rate_idx will only be used when initialized because ath11k_accumulate_per_peer_tx_stats only uses rate_idx when flags is not set to RATE_INFO_FLAGS_HE_MCS, RATE_INFO_FLAGS_VHT_MCS, or RATE_INFO_FLAGS_MCS. Still, it is not good to stick uninitialized values into another function so initialize it to zero to prevent any issues down the line.

Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Reported-by [email protected]
---
 drivers/net/wireless/ath/ath11k/debugfs_sta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/debugfs_sta.c +1 -1
index 743760c9bcae..a5bdd16d6d46 100644
@@ -136,7 +136,7 @@ void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar,
 	struct ath11k_sta *arsta;
 	struct ieee80211_sta *sta;
 	u16 rate;
-	u8 rate_idx;
+	u8 rate_idx = 0;
 	int ret;
 	u8 mcs;
 
Signature · 1 line
2.25.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Nathan Chancellor

Clang warns a few times (trimmed for brevity):

../drivers/net/wireless/ath/ath11k/debugfs_sta.c:185:7: warning:
variable 'rate_idx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

It is not wrong, rate_idx is only initialized in the first if block. However, this is not necessarily an issue in practice because rate_idx will only be used when initialized because ath11k_accumulate_per_peer_tx_stats only uses rate_idx when flags is not set to RATE_INFO_FLAGS_HE_MCS, RATE_INFO_FLAGS_VHT_MCS, or RATE_INFO_FLAGS_MCS. Still, it is not good to stick uninitialized values into another function so initialize it to zero to prevent any issues down the line.

Quoted 4 lines
Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Reported-by [email protected]

Thanks for the patch. A bit tricky to follow that this (previously) is safe.

Quoted 24 lines
---
 drivers/net/wireless/ath/ath11k/debugfs_sta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/debugfs_sta.c +1 -2
index 743760c9bcae..a5bdd16d6d46 100644
@@ -136,7 +136,7 @@ void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar,
        struct ath11k_sta *arsta;
        struct ieee80211_sta *sta;
        u16 rate;
-       u8 rate_idx;
+       u8 rate_idx = 0;
        int ret;
        u8 mcs;
 
--

2.25.0

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200130015905.18610-1-natechancellor%40gmail.com.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
In reply to Nathan Chancellor
Quoted 15 lines · Nathan Chancellor

Clang warns a few times (trimmed for brevity):

../drivers/net/wireless/ath/ath11k/debugfs_sta.c:185:7: warning:
variable 'rate_idx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

It is not wrong, rate_idx is only initialized in the first if block. However, this is not necessarily an issue in practice because rate_idx will only be used when initialized because ath11k_accumulate_per_peer_tx_stats only uses rate_idx when flags is not set to RATE_INFO_FLAGS_HE_MCS, RATE_INFO_FLAGS_VHT_MCS, or RATE_INFO_FLAGS_MCS. Still, it is not good to stick uninitialized values into another function so initialize it to zero to prevent any issues down the line.

Quoted 6 lines
Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Reported-by [email protected]

Patch applied to ath-next branch of ath.git, thanks.

df57acc415b1 ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl

Signature · 8 lines
https://patchwork.kernel.org/patch/11357331/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#3 lore raw
In reply to Nathan Chancellor
Quoted 15 lines · Nathan Chancellor

Clang warns a few times (trimmed for brevity):

../drivers/net/wireless/ath/ath11k/debugfs_sta.c:185:7: warning:
variable 'rate_idx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

It is not wrong, rate_idx is only initialized in the first if block. However, this is not necessarily an issue in practice because rate_idx will only be used when initialized because ath11k_accumulate_per_peer_tx_stats only uses rate_idx when flags is not set to RATE_INFO_FLAGS_HE_MCS, RATE_INFO_FLAGS_VHT_MCS, or RATE_INFO_FLAGS_MCS. Still, it is not good to stick uninitialized values into another function so initialize it to zero to prevent any issues down the line.

Quoted 6 lines
Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Reported-by [email protected]

Patch applied to ath-next branch of ath.git, thanks.

df57acc415b1 ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl

Signature · 3 lines
https://patchwork.kernel.org/patch/11357331/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Hi Kalle, I still see this warning in KernelCI builds of linux-next. Is ath-next flowing into linux-next? I just want to triple check that this fix gets sent along.

Quoted 38 lines · Kalle Valo
Quoted 15 lines · Nathan Chancellor

Clang warns a few times (trimmed for brevity):

../drivers/net/wireless/ath/ath11k/debugfs_sta.c:185:7: warning:
variable 'rate_idx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

It is not wrong, rate_idx is only initialized in the first if block. However, this is not necessarily an issue in practice because rate_idx will only be used when initialized because ath11k_accumulate_per_peer_tx_stats only uses rate_idx when flags is not set to RATE_INFO_FLAGS_HE_MCS, RATE_INFO_FLAGS_VHT_MCS, or RATE_INFO_FLAGS_MCS. Still, it is not good to stick uninitialized values into another function so initialize it to zero to prevent any issues down the line.

Quoted 6 lines
Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Reported-by [email protected]

Patch applied to ath-next branch of ath.git, thanks.

df57acc415b1 ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl

--
https://patchwork.kernel.org/patch/11357331/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200211142431.243E6C433A2%40smtp.codeaurora.org.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#6 lore raw
Quoted 3 lines · Nick Desaulniers

Hi Kalle, I still see this warning in KernelCI builds of linux-next. Is ath-next flowing into linux-next? I just want to triple check that this fix gets sent along.

ath-next is not pulled to linux-next. But this commit is in wireless-drivers-next now and that tree is pulled to linux-next.

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches