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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ygnhk0jtwqs6.fsf@nvidia.com>
Date:   Mon, 6 Sep 2021 20:35:37 +0300
From:   Vlad Buslov <vladbu@...dia.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Saeed Mahameed <saeedm@...dia.com>
CC:     Naresh Kamboju <naresh.kamboju@...aro.org>,
        open list <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        <lkft-triage@...ts.linaro.org>, Netdev <netdev@...r.kernel.org>,
        Nathan Chancellor <natechancellor@...il.com>,
        "Nick Desaulniers" <ndesaulniers@...gle.com>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: bridge.c:157:11: error: variable 'err' is used uninitialized
 whenever 'if' condition is false

On Mon 06 Sep 2021 at 19:39, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Mon, Sep 6, 2021 at 2:11 AM Naresh Kamboju <naresh.kamboju@...aro.org> wrote:
>>
>> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: error:
>> variable 'err' is used uninitialized whenever 'if' condition is false
>
> That compiler warning (now error) seems to be entirely valid.

I agree, this is a real issue. It had been reported before and my fix
for it was submitted by Saeed last week but wasn't accepted since it was
part of larger series that also included features and net-next had
already been closed by that time. As far as I understand it is pending
submission to net as part of series of bug fixes. Sorry for the delay.

>
> That's a
>
>     if (..)
>     else if (..)
>
> and if neither are valid then the code will return an uninitialized 'err'.
>
> It's possible the two conditionals are guaranteed to cover all cases,
> but as the compiler says, in that case the "if" in the else clause is
> pointless and should be removed.
>
> But it does look like 'ret' should probably just be initialized to 0.

Yep, this if exactly what I did in my patch "net/mlx5: Bridge, fix
uninitialized variable usage".

>
>               Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ