lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220726165454.123991-1-hristo@venev.name>
Date:   Tue, 26 Jul 2022 19:54:54 +0300
From:   Hristo Venev <hristo@...ev.name>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org, Hristo Venev <hristo@...ev.name>
Subject: [PATCH net v2] be2net: Fix uninitialized variable

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@...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))
-- 
2.37.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ