From: Kalle Valo <kvalo@kernel.org>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] wifi: rtl8xxxu: Fix reads of uninitialized variables hw_ctrl_s1, sw_ctrl_s1
Date: Fri, 21 Oct 2022 13:48:11 +0300 [thread overview]
Message-ID: <87bkq51mhg.fsf@kernel.org> (raw)
In-Reply-To: <87ilkdlq48.fsf@kernel.org> (Kalle Valo's message of "Fri, 21 Oct 2022 08:09:27 +0300")
Kalle Valo <kvalo@kernel.org> writes:
> Colin Ian King <colin.i.king@gmail.com> writes:
>
>> Variables hw_ctrl_s1 and sw_ctrl_s1 are not being initialized and
>> potentially can contain any garbage value. Currently there is an if
>> statement that sets one or the other of these variables, followed
>> by an if statement that checks if any of these variables have been
>> set to a non-zero value. In the case where they may contain
>> uninitialized non-zero values, the latter if statement may be
>> taken as true when it was not expected to.
>>
>> Fix this by ensuring hw_ctrl_s1 and sw_ctrl_s1 are initialized.
>>
>> Cleans up clang warning:
>> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:432:7: warning:
>> variable 'hw_ctrl_s1' is used uninitialized whenever 'if' condition is
>> false [-Wsometimes-uninitialized]
>> if (hw_ctrl) {
>> ^~~~~~~
>> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:440:7: note: uninitialized
>> use occurs here
>> if (hw_ctrl_s1 || sw_ctrl_s1) {
>> ^~~~~~~~~~
>> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:432:3: note: remove the 'if'
>> if its condition is always true
>> if (hw_ctrl) {
>> ^~~~~~~~~~~~~
>>
>> Fixes: c888183b21f3 ("wifi: rtl8xxxu: Support new chip RTL8188FU")
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>
> I'll queue this to v6.1.
Actually commit c888183b21f3 is in wireless-next so this patch should go
to wireless-next, for v6.2.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2022-10-21 10:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 13:57 [PATCH][next] wifi: rtl8xxxu: Fix reads of uninitialized variables hw_ctrl_s1, sw_ctrl_s1 Colin Ian King
2022-10-20 15:11 ` Nathan Chancellor
2022-10-21 5:09 ` Kalle Valo
2022-10-21 10:48 ` Kalle Valo [this message]
2022-10-21 12:55 ` 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=87bkq51mhg.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=Jes.Sorensen@gmail.com \
--cc=colin.i.king@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rtl8821cerfe2@gmail.com \
/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 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).