* [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl
@ 2020-01-30 1:59 Nathan Chancellor
2020-02-03 15:18 ` Nick Desaulniers
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Nathan Chancellor @ 2020-01-30 1:59 UTC (permalink / raw)
To: Kalle Valo
Cc: ath11k, linux-wireless, netdev, linux-kernel, clang-built-linux,
Nathan Chancellor, ci_notify
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")
Link: https://github.com/ClangBuiltLinux/linux/issues/832
Reported-by: ci_notify@linaro.org
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/net/wireless/ath/ath11k/debugfs_sta.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
index 743760c9bcae..a5bdd16d6d46 100644
--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
@@ -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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl
2020-01-30 1:59 [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl Nathan Chancellor
@ 2020-02-03 15:18 ` Nick Desaulniers
2020-02-11 14:24 ` Kalle Valo
[not found] ` <20200211142431.243E6C433A2@smtp.codeaurora.org>
2 siblings, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2020-02-03 15:18 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Kalle Valo, ath11k, linux-wireless, Network Development, LKML,
clang-built-linux, CI Notify
On Thu, Jan 30, 2020 at 1:59 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/832
> Reported-by: ci_notify@linaro.org
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Thanks for the patch. A bit tricky to follow that this (previously) is safe.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> drivers/net/wireless/ath/ath11k/debugfs_sta.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
> index 743760c9bcae..a5bdd16d6d46 100644
> --- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c
> +++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
> @@ -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 clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200130015905.18610-1-natechancellor%40gmail.com.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl
2020-01-30 1:59 [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl Nathan Chancellor
2020-02-03 15:18 ` Nick Desaulniers
@ 2020-02-11 14:24 ` Kalle Valo
[not found] ` <20200211142431.243E6C433A2@smtp.codeaurora.org>
2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2020-02-11 14:24 UTC (permalink / raw)
To: Nathan Chancellor
Cc: ath11k, linux-wireless, netdev, linux-kernel, clang-built-linux,
Nathan Chancellor, ci_notify
Nathan Chancellor <natechancellor@gmail.com> wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/832
> Reported-by: ci_notify@linaro.org
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20200211142431.243E6C433A2@smtp.codeaurora.org>]
* Re: [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl
[not found] ` <20200211142431.243E6C433A2@smtp.codeaurora.org>
@ 2020-03-16 21:15 ` Nick Desaulniers
2020-03-17 8:29 ` Kalle Valo
0 siblings, 1 reply; 5+ messages in thread
From: Nick Desaulniers @ 2020-03-16 21:15 UTC (permalink / raw)
To: Kalle Valo
Cc: Nathan Chancellor, ath11k, linux-wireless, Network Development,
LKML, clang-built-linux, CI Notify
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.
On Tue, Feb 11, 2020 at 6:24 AM Kalle Valo <kvalo@codeaurora.org> wrote:
>
> Nathan Chancellor <natechancellor@gmail.com> wrote:
>
> > 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")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/832
> > Reported-by: ci_notify@linaro.org
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
>
> 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 clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200211142431.243E6C433A2%40smtp.codeaurora.org.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-17 8:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-30 1:59 [PATCH] ath11k: Silence clang -Wsometimes-uninitialized in ath11k_update_per_peer_stats_from_txcompl Nathan Chancellor
2020-02-03 15:18 ` Nick Desaulniers
2020-02-11 14:24 ` Kalle Valo
[not found] ` <20200211142431.243E6C433A2@smtp.codeaurora.org>
2020-03-16 21:15 ` Nick Desaulniers
2020-03-17 8:29 ` Kalle Valo
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).