[bug report] be2net: Fix buffer overflow in be_get_module_eeprom

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

 



Hello Hristo Venev,

The patch d7241f679a59: "be2net: Fix buffer overflow in
be_get_module_eeprom" from Jul 16, 2022, leads to the following
Smatch static checker warning:

	drivers/net/ethernet/emulex/benet/be_ethtool.c:1392 be_get_module_eeprom()
	error: uninitialized symbol 'status'.

drivers/net/ethernet/emulex/benet/be_ethtool.c
    1360 static int be_get_module_eeprom(struct net_device *netdev,
    1361                                 struct ethtool_eeprom *eeprom, u8 *data)
    1362 {
    1363         struct be_adapter *adapter = netdev_priv(netdev);
    1364         int status;
    1365         u32 begin, end;
    1366 
    1367         if (!check_privilege(adapter, MAX_PRIVILEGES))
    1368                 return -EOPNOTSUPP;
    1369 
    1370         begin = eeprom->offset;
    1371         end = eeprom->offset + eeprom->len;
    1372 
    1373         if (begin < PAGE_DATA_LEN) {
    1374                 status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, begin,
    1375                                                            min_t(u32, end, PAGE_DATA_LEN) - begin,
    1376                                                            data);
    1377                 if (status)
    1378                         goto err;
    1379 
    1380                 data += PAGE_DATA_LEN - begin;
    1381                 begin = PAGE_DATA_LEN;
    1382         }
    1383 
    1384         if (end > PAGE_DATA_LEN) {
    1385                 status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A2,
    1386                                                            begin - PAGE_DATA_LEN,
    1387                                                            end - begin, data);
    1388                 if (status)
    1389                         goto err;
    1390         }

status is not initalized if both conditions are false.

    1391 err:
--> 1392         return be_cmd_status(status);
    1393 }

regards,
dan carpenter



[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