From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: net: dsa: mv88e6xxx: Add devlink regions
Date: Wed, 9 Oct 2024 17:20:09 +0100 [thread overview]
Message-ID: <13c4d51e-7209-48c6-883b-661395798a9a@gmail.com> (raw)
Hi Andrew,
Static analysis on linux-next has detected a potential issue with an
function returning an uninitialized value from function
mv88e6xxx_region_atu_snapshot in drivers/net/dsa/mv88e6xxx/devlink.c
The commit in question is:
commit bfb255428966e2ab2c406cf6c71d95e9e63241e4
Author: Andrew Lunn <andrew@lunn.ch>
Date: Fri Sep 18 21:11:07 2020 +0200
net: dsa: mv88e6xxx: Add devlink regions
Variable err is not being initialized at the start of the function. In
the following while-loop err is not being assigned if id ==
MV88E6XXX_N_FID because of the early break out of the loop. This can end
up with the function returning an uninitialized value in err.
I'm not sure of this is ever going to happen, or if in this case this is
an error condition or not, so I'm unsure if err should be initialized to
zero or some other value.
while (1) {
fid = find_next_bit(chip->fid_bitmap, MV88E6XXX_N_FID,
fid + 1);
if (fid == MV88E6XXX_N_FID)
break;
err = mv88e6xxx_region_atu_snapshot_fid(chip, fid, table,
&count);
if (err) {
kfree(table);
goto out;
}
}
*data = (u8 *)table;
out:
mv88e6xxx_reg_unlock(chip);
return err;
Regards,
Colin
next reply other threads:[~2024-10-09 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 16:20 Colin King (gmail) [this message]
2024-10-09 16:30 ` Andrew Lunn
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=13c4d51e-7209-48c6-883b-661395798a9a@gmail.com \
--to=colin.i.king@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®