Skip to contentSkip to conversation

ice: initialize local variable 'tlv'

PATCH In review [email protected] 2 participants 2 messages Feb 14, 2022 – Feb 18, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: initialize local variable 'tlv'

From: Tom Rix <[email protected]>

Clang static analysis reports this issues ice_common.c:5008:21: warning: The left expression of the compound
assignment is an uninitialized value. The computed value will also be garbage
ldo->phy_type_low |= ((u64)buf << (i * 16)); ~~~~~~~~~~~~~~~~~ ^

When called from ice_cfg_phy_fec() ldo is the unintialized local variable tlv. So initialize.

Fixes ea78ce4dab05 ("ice: add link lenient and default override support")
---
 drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
index c57e5fc41cf8..0e4434e3c290 100644
@@ -3379,7 +3379,7 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
 
 	if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(hw) &&
 	    !ice_fw_supports_report_dflt_cfg(hw)) {
-		struct ice_link_default_override_tlv tlv;
+		struct ice_link_default_override_tlv tlv = { 0 };
 
 		status = ice_get_link_default_override(&tlv, pi);
 		if (status)
Signature · 1 line
2.26.3
Tested-by on v1 1/1
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of trix at redhat.com
Sent: Monday, February 14, 2022 9:11 PM
To: Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; davem at davemloft.net; kuba at kernel.org; nathan at kernel.org; ndesaulniers at google.com; Greenwalt, Paul <[email protected]>; Swanson, Evan <[email protected]>
Cc: netdev at vger.kernel.org; llvm at lists.linux.dev; intel-wired- lan at lists.osuosl.org; linux-kernel at vger.kernel.org; Tom Rix <[email protected]>
Subject: [Intel-wired-lan] [PATCH] ice: initialize local variable 'tlv'

From: Tom Rix <[email protected]>

Clang static analysis reports this issues ice_common.c:5008:21: warning: The left expression of the compound
assignment is an uninitialized value. The computed value will also be garbage
ldo->phy_type_low |= ((u64)buf << (i * 16)); ~~~~~~~~~~~~~~~~~ ^

Quoted 9 lines

When called from ice_cfg_phy_fec() ldo is the unintialized local variable tlv. So initialize.

Fixes ea78ce4dab05 ("ice: add link lenient and default override support")
---
 drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)