[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220727102722.722e324f@kernel.org>
Date: Wed, 27 Jul 2022 10:27:22 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Hristo Venev <hristo@...ev.name>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net v2] be2net: Fix uninitialized variable
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@...cle.com>
> Fixes: d7241f679a59 ("be2net: Fix buffer overflow in be_get_module_eeprom")
> Signed-off-by: Hristo Venev <hristo@...ev.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))
Powered by blists - more mailing lists