[PATCH net v2] be2net: Fix uninitialized variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Fixes: d7241f679a59 ("be2net: Fix buffer overflow in be_get_module_eeprom")
Signed-off-by: Hristo Venev <hristo@xxxxxxxxxx>
---
 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




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux