LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vlad Buslov <email@example.com>
To: Linus Torvalds <firstname.lastname@example.org>,
Saeed Mahameed <email@example.com>
Cc: Naresh Kamboju <firstname.lastname@example.org>,
open list <email@example.com>,
<firstname.lastname@example.org>, Netdev <email@example.com>,
Nathan Chancellor <firstname.lastname@example.org>,
"Nick Desaulniers" <email@example.com>,
"David S. Miller" <firstname.lastname@example.org>
Subject: Re: bridge.c:157:11: error: variable 'err' is used uninitialized whenever 'if' condition is false
Date: Mon, 6 Sep 2021 20:35:37 +0300 [thread overview]
Message-ID: <email@example.com> (raw)
On Mon 06 Sep 2021 at 19:39, Linus Torvalds <firstname.lastname@example.org> wrote:
> On Mon, Sep 6, 2021 at 2:11 AM Naresh Kamboju <email@example.com> 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".
next prev parent reply other threads:[~2021-09-06 17:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 9:10 Naresh Kamboju
2021-09-06 16:39 ` Linus Torvalds
2021-09-06 17:35 ` Vlad Buslov [this message]
2021-09-07 20:34 ` Saeed Mahameed
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--subject='Re: bridge.c:157:11: error: variable '\''err'\'' is used uninitialized whenever '\''if'\'' condition is false' \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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).