From: Jakub Kicinski <kuba@kernel.org>
To: Hristo Venev <hristo@venev.name>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net v2] be2net: Fix uninitialized variable
Date: Wed, 27 Jul 2022 10:27:22 -0700 [thread overview]
Message-ID: <20220727102722.722e324f@kernel.org> (raw)
In-Reply-To: <20220726165454.123991-1-hristo@venev.name>
On Tue, 26 Jul 2022 19:54:54 +0300 Hristo Venev wrote:
> The following error is reported by Smatch:
>
> drivers/net/ethernet/emulex/benet/be_ethtool.c:1392 be_get_module_eeprom()
> error: uninitialized symbol 'status'.
>
> When `eeprom->len == 0` and `eeprom->begin == PAGE_DATA_LEN`, we end
> up with neither of the pages being read, so `status` is left
> uninitialized.
>
> While it appears that no caller will actually give `get_module_eeprom`
> a zero length, fixing this issue is trivial.
If there is no caller that can trigger this - it's not a fix. Fixes are
for bugs which can be triggered. Please repost against net-next without
the Fixes tag. Please don't post the v3 in reply to v2, just add a
changelog under the --- marker and make a fresh thread.
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: d7241f679a59 ("be2net: Fix buffer overflow in be_get_module_eeprom")
> Signed-off-by: Hristo Venev <hristo@venev.name>
> ---
> drivers/net/ethernet/emulex/benet/be_ethtool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
> index bd0df189d871..2145882d00cc 100644
> --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
> +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
> @@ -1361,7 +1361,7 @@ static int be_get_module_eeprom(struct net_device *netdev,
> struct ethtool_eeprom *eeprom, u8 *data)
> {
> struct be_adapter *adapter = netdev_priv(netdev);
> - int status;
> + int status = 0;
> u32 begin, end;
>
> if (!check_privilege(adapter, MAX_PRIVILEGES))
prev parent reply other threads:[~2022-07-27 18:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <YtlIZgG/wQtxpKMh@kili>
2022-07-22 15:20 ` [PATCH] be2net: Fix Smatch error Hristo Venev
2022-07-23 4:42 ` Jakub Kicinski
2022-07-26 16:54 ` [PATCH net v2] be2net: Fix uninitialized variable Hristo Venev
2022-07-27 17:27 ` Jakub Kicinski [this message]
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=20220727102722.722e324f@kernel.org \
--to=kuba@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=hristo@venev.name \
--cc=kernel-janitors@vger.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).