All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Sriram R <srirrama@codeaurora.org>,
	Miaoqing Pan <miaoqing@codeaurora.org>,
	Pradeep kumar Chitrapu <pradeepc@codeaurora.org>,
	Balaji Pothunoori <bpothuno@codeaurora.org>,
	Brian Norris <briannorris@chromium.org>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	ath10k@lists.infradead.org, clang-built-linux@googlegroups.com,
	netdev@vger.kernel.org, Rakesh Pillai <pillair@codeaurora.org>,
	Wen Gong <wgong@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	Kalle Valo <kvalo@codeaurora.org>
Subject: Re: [PATCH] ath10k: work around uninitialized vht_pfr variable
Date: Mon, 8 Jul 2019 07:46:38 -0700	[thread overview]
Message-ID: <20190708144638.GA43693@archlinux-epyc> (raw)
In-Reply-To: <20190708125050.3689133-1-arnd@arndb.de>

On Mon, Jul 08, 2019 at 02:50:06PM +0200, Arnd Bergmann wrote:
> As clang points out, the vht_pfr is assigned to a struct member
> without being initialized in one case:
> 
> drivers/net/wireless/ath/ath10k/mac.c:7528:7: error: variable 'vht_pfr' is used uninitialized whenever 'if' condition
>       is false [-Werror,-Wsometimes-uninitialized]
>                 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask,
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7551:20: note: uninitialized use occurs here
>                 arvif->vht_pfr = vht_pfr;
>                                  ^~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7528:3: note: remove the 'if' if its condition is always true
>                 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask,
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7483:12: note: initialize the variable 'vht_pfr' to silence this warning
>         u8 vht_pfr;
> 
> Add an explicit but probably incorrect initialization here.
> I suspect we want a better fix here, but chose this approach to
> illustrate the issue.

Yup, I reached out to the maintainers when this issue first cropped up,
should have taken your approach though.

https://lore.kernel.org/lkml/20190702181837.GA118849@archlinux-epyc/

Initializing to zero is better than uninitialized.

> 
> Fixes: 8b97b055dc9d ("ath10k: fix failure to set multiple fixed rate")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	Miaoqing Pan <miaoqing@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	Rakesh Pillai <pillair@codeaurora.org>,
	Brian Norris <briannorris@chromium.org>,
	Balaji Pothunoori <bpothuno@codeaurora.org>,
	Wen Gong <wgong@codeaurora.org>,
	Pradeep kumar Chitrapu <pradeepc@codeaurora.org>,
	Sriram R <srirrama@codeaurora.org>,
	ath10k@lists.infradead.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH] ath10k: work around uninitialized vht_pfr variable
Date: Mon, 8 Jul 2019 07:46:38 -0700	[thread overview]
Message-ID: <20190708144638.GA43693@archlinux-epyc> (raw)
In-Reply-To: <20190708125050.3689133-1-arnd@arndb.de>

On Mon, Jul 08, 2019 at 02:50:06PM +0200, Arnd Bergmann wrote:
> As clang points out, the vht_pfr is assigned to a struct member
> without being initialized in one case:
> 
> drivers/net/wireless/ath/ath10k/mac.c:7528:7: error: variable 'vht_pfr' is used uninitialized whenever 'if' condition
>       is false [-Werror,-Wsometimes-uninitialized]
>                 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask,
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7551:20: note: uninitialized use occurs here
>                 arvif->vht_pfr = vht_pfr;
>                                  ^~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7528:3: note: remove the 'if' if its condition is always true
>                 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask,
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7483:12: note: initialize the variable 'vht_pfr' to silence this warning
>         u8 vht_pfr;
> 
> Add an explicit but probably incorrect initialization here.
> I suspect we want a better fix here, but chose this approach to
> illustrate the issue.

Yup, I reached out to the maintainers when this issue first cropped up,
should have taken your approach though.

https://lore.kernel.org/lkml/20190702181837.GA118849@archlinux-epyc/

Initializing to zero is better than uninitialized.

> 
> Fixes: 8b97b055dc9d ("ath10k: fix failure to set multiple fixed rate")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

  reply	other threads:[~2019-07-08 14:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 12:50 [PATCH] ath10k: work around uninitialized vht_pfr variable Arnd Bergmann
2019-07-08 12:50 ` Arnd Bergmann
2019-07-08 14:46 ` Nathan Chancellor [this message]
2019-07-08 14:46   ` Nathan Chancellor
2019-07-08 20:34 ` Brian Norris
2019-07-08 20:34   ` Brian Norris
2019-07-15  9:44 ` Kalle Valo
2019-07-15  9:44   ` Kalle Valo
2019-07-15 17:50 ` Kalle Valo
2019-07-15 17:50 ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190708144638.GA43693@archlinux-epyc \
    --to=natechancellor@gmail.com \
    --cc=arnd@arndb.de \
    --cc=ath10k@lists.infradead.org \
    --cc=bpothuno@codeaurora.org \
    --cc=briannorris@chromium.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=miaoqing@codeaurora.org \
    --cc=netdev@vger.kernel.org \
    --cc=pillair@codeaurora.org \
    --cc=pradeepc@codeaurora.org \
    --cc=srirrama@codeaurora.org \
    --cc=wgong@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.