lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 16 Nov 2018 11:55:27 +0200
From:   Kalle Valo <kvalo@...eaurora.org>
To:     Brian Norris <briannorris@...omium.org>
Cc:     Arnd Bergmann <arnd@...db.de>, srirrama@...eaurora.org,
        bpothuno@...eaurora.org, akolli@...eaurora.org,
        linux-wireless@...r.kernel.org,
        Linux Kernel <linux-kernel@...r.kernel.org>,
        yintang@....qualcomm.com, pillair@...eaurora.org,
        ath10k@...ts.infradead.org, netdev@...r.kernel.org,
        davem@...emloft.net
Subject: Re: [PATCH] ath10k: avoid -Wmaybe-uninitialized warning

Brian Norris <briannorris@...omium.org> writes:

> Hi,
>
> On Fri, Nov 2, 2018 at 9:19 AM Arnd Bergmann <arnd@...db.de> wrote:
>>
>> In some configurations the inlining in gcc is suboptimal, causing
>> a false-positive warning:
>>
>> drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_mac_init_rd':
>> drivers/net/wireless/ath/ath10k/mac.c:8374:39: error: 'rd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>   ar->ath_common.regulatory.current_rd = rd;
>>
>> If we initialize the output of ath10k_mac_get_wrdd_regulatory()
>> before returning, this problem goes away.
>>
>> Fixes: 209b2a68de76 ("ath10k: add platform regulatory domain support")
>> Signed-off-by: Arnd Bergmann <arnd@...db.de>
>> ---
>>  drivers/net/wireless/ath/ath10k/mac.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
>> index a1c2801ded10..0d5fde28ee44 100644
>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>> @@ -8321,6 +8321,8 @@ static int ath10k_mac_get_wrdd_regulatory(struct ath10k *ar, u16 *rd)
>>         u32 alpha2_code;
>>         char alpha2[3];
>>
>> +       *rd = ar->hw_eeprom_rd;
>> +
>
> Maybe it's just me, but it seems kinda weird for this function to
> assign a (valid) value to its "output" and still potentially return an
> error.
>
> If you really need to work around this compiler bug, maybe just put
> the eeprom assignment back in ath10k_mac_init_rd()? I'll leave it up
> to Kalle as to whether he wants to work around the compiler at all :)

In general I'm happy take workaround to compiler problems, I prefer to
keep ath10k warning free much as possible.

> Oh wait, one more thing: this is actually an invalid refactoring. See
> how this function assigns '*rd' later in error cases. Today, we still
> treat those as errors and clobber those with the eeprom value, but
> now, you're making the fallback case continue to use the erroneous
> value (0xffff). You need to make that use a local variable and avoid
> clobbering *rd, if you want this to be correct.

But I agree with Brian here, I don't think this patch is correct.

-- 
Kalle Valo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ