From: <Daniel.Machon@microchip.com>
To: <error27@gmail.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <Lars.Povlsen@microchip.com>,
<Steen.Hegelund@microchip.com>, <UNGLinuxDriver@microchip.com>,
<netdev@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH net-next] net: microchip: sparx5: prevent uninitialized variable
Date: Wed, 16 Nov 2022 07:09:12 +0000 [thread overview]
Message-ID: <Y3SPJprgA9l35k5v@DEN-LT-70577> (raw)
In-Reply-To: <Y3OQrGoFqvX2GkbJ@kili>
> Smatch complains that:
>
> drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c:112
> sparx5_dcb_apptrust_validate() error: uninitialized symbol 'match'.
>
> This would only happen if the:
>
> if (sparx5_dcb_apptrust_policies[i].nselectors != nselectors)
>
> condition is always true (they are not equal). The "nselectors"
> variable comes from dcbnl_ieee_set() and it is a number between 0-256.
> This seems like a probably a real bug.
That is indeed a bug.
Thank you, much appreciated.
>
> Fixes: 23f8382cd95d ("net: microchip: sparx5: add support for apptrust")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c b/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
> index 8108f3767767..74abb946b2a3 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
> @@ -90,7 +90,7 @@ static int sparx5_dcb_app_validate(struct net_device *dev,
> static int sparx5_dcb_apptrust_validate(struct net_device *dev, u8 *selectors,
> int nselectors, int *err)
> {
> - bool match;
> + bool match = false;
> int i, ii;
>
> for (i = 0; i < ARRAY_SIZE(sparx5_dcb_apptrust_policies); i++) {
> --
> 2.35.1
>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
next prev parent reply other threads:[~2022-11-16 7:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 13:14 [PATCH net-next] net: microchip: sparx5: prevent uninitialized variable Dan Carpenter
2022-11-16 7:09 ` Daniel.Machon [this message]
2022-11-17 15:03 ` Paolo Abeni
2022-11-17 15:29 ` Dan Carpenter
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=Y3SPJprgA9l35k5v@DEN-LT-70577 \
--to=daniel.machon@microchip.com \
--cc=Lars.Povlsen@microchip.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).