Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452796 > unrolled thread

[PATCH 1/1] net: e1000: do not use uninitalized variable.

Started byHeinrich Schuchardt <xypron.glpk@gmx.de>
First post2016-07-31 11:40 +0200
Last post2016-08-01 05:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] net: e1000: do not use uninitalized variable. Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-07-31 11:40 +0200
    Re: [PATCH 1/1] net: e1000: do not use uninitalized variable. David Miller <davem@davemloft.net> - 2016-08-01 05:50 +0200

#1452796 — [PATCH 1/1] net: e1000: do not use uninitalized variable.

FromHeinrich Schuchardt <xypron.glpk@gmx.de>
Date2016-07-31 11:40 +0200
Subject[PATCH 1/1] net: e1000: do not use uninitalized variable.
Message-ID<s0VnX-6Kr-1@gated-at.bofh.it>
phy_data has to be set to zero to avoid undefined
behavior.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/net/ethernet/intel/e1000/e1000_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c
index 8172cf0..456bb07 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c
@@ -5390,7 +5390,7 @@ static s32 e1000_set_phy_mode(struct e1000_hw *hw)
 static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
 {
 	s32 ret_val;
-	u16 phy_data;
+	u16 phy_data = 0;
 
 	if (hw->phy_type != e1000_phy_igp)
 		return E1000_SUCCESS;
-- 
2.8.1

[toc] | [next] | [standalone]


#1452958

FromDavid Miller <davem@davemloft.net>
Date2016-08-01 05:50 +0200
Message-ID<s1coN-Tv-5@gated-at.bofh.it>
In reply to#1452796
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Sun, 31 Jul 2016 11:30:58 +0200

> phy_data has to be set to zero to avoid undefined
> behavior.

In your opinion.

phy_data is only used in conditions where it has been initialized
in this function.

Therefore, please read the function carefully instead of just having
knee jerk reactions to whatever the compiler spits out.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web