[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220722152050.3752-1-hristo@venev.name>
Date: Fri, 22 Jul 2022 18:20:52 +0300
From: Hristo Venev <hristo@...ev.name>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, kernel-janitors@...r.kernel.org,
Hristo Venev <hristo@...ev.name>
Subject: [PATCH] be2net: Fix Smatch error
drivers/net/ethernet/emulex/benet/be_ethtool.c:1392 be_get_module_eeprom()
error: uninitialized symbol 'status'.
When `eeprom->len == 0` and `eeprom->offset == 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.
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))
--
2.37.1
Powered by blists - more mailing lists