public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] ice: initialize local variable 'tlv'
@ 2022-02-14 15:40 trix
  2022-02-18 17:06 ` [Intel-wired-lan] " G, GurucharanX
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2022-02-14 15:40 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, davem, kuba, nathan,
	ndesaulniers, paul.greenwalt, evan.swanson
  Cc: intel-wired-lan, netdev, linux-kernel, llvm, Tom Rix

From: Tom Rix <trix@redhat.com>

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")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index c57e5fc41cf8..0e4434e3c290 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -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)
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [Intel-wired-lan] [PATCH] ice: initialize local variable 'tlv'
  2022-02-14 15:40 [PATCH] ice: initialize local variable 'tlv' trix
@ 2022-02-18 17:06 ` G, GurucharanX
  0 siblings, 0 replies; 2+ messages in thread
From: G, GurucharanX @ 2022-02-18 17:06 UTC (permalink / raw)
  To: trix@redhat.com, Brandeburg, Jesse, Nguyen, Anthony L,
	davem@davemloft.net, kuba@kernel.org, nathan@kernel.org,
	ndesaulniers@google.com, Greenwalt, Paul, Swanson, Evan
  Cc: netdev@vger.kernel.org, llvm@lists.linux.dev,
	intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> trix@redhat.com
> Sent: Monday, February 14, 2022 9:11 PM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; davem@davemloft.net; kuba@kernel.org;
> nathan@kernel.org; ndesaulniers@google.com; Greenwalt, Paul
> <paul.greenwalt@intel.com>; Swanson, Evan <evan.swanson@intel.com>
> Cc: netdev@vger.kernel.org; llvm@lists.linux.dev; intel-wired-
> lan@lists.osuosl.org; linux-kernel@vger.kernel.org; Tom Rix
> <trix@redhat.com>
> Subject: [Intel-wired-lan] [PATCH] ice: initialize local variable 'tlv'
> 
> From: Tom Rix <trix@redhat.com>
> 
> 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")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-18 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-14 15:40 [PATCH] ice: initialize local variable 'tlv' trix
2022-02-18 17:06 ` [Intel-wired-lan] " G, GurucharanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox