Skip to contentSkip to conversation

net/i40e: fix shifts of 32-bit value

PATCH Applied Beilei Xing 3 participants 3 messages May 23, 2018 – Jun 21, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: fix shifts of 32-bit value

Cppcheck reports following error,
(error) Shifting 32-bit value by 36 bits is undefined behaviour

According to datasheet, there's PHY type and PHY type extension in setting PHY config command, should exclude PHY type extension when setting PHY type.

Fixes 1bb8f661168d ("net/i40e: fix link down and negotiation")
---
 drivers/net/i40e/i40e_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
index 7d4f1c9..9792205 100644
@@ -2065,8 +2065,8 @@ i40e_phy_conf_link(struct i40e_hw *hw,
 
 
 
-	/* To enable link, phy_type mask needs to include each type */
-	for (cnt = I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++)
+	/* PHY type mask needs to include each type except PHY type extension */
+	for (cnt = I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_25GBASE_KR; cnt++)
 		phy_type_mask |= 1 << cnt;
 
 	/* use get_phy_abilities_resp value for the rest */
Signature · 1 line
2.5.5
#1 lore raw
Quoted 10 lines · Beilei Xing

Cppcheck reports following error,
(error) Shifting 32-bit value by 36 bits is undefined behaviour

According to datasheet, there's PHY type and PHY type extension in setting PHY config command, should exclude PHY type extension when setting PHY type.

Fixes 1bb8f661168d ("net/i40e: fix link down and negotiation")

Hi Beilei,

This patc was late for rc5, it will be considered for next release.

Thanks,
ferruh

Acked-by on v1 1/1 Applied
#2 lore raw
In reply to Beilei Xing
Quoted 12 lines

-----Original Message-----
From: Xing, Beilei
Sent: Wednesday, May 23, 2018 3:47 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>
Subject: [PATCH] net/i40e: fix shifts of 32-bit value

Cppcheck reports following error,
(error) Shifting 32-bit value by 36 bits is undefined behaviour

Quoted 6 lines

According to datasheet, there's PHY type and PHY type extension in setting PHY config command, should exclude PHY type extension when setting PHY type.

Fixes 1bb8f661168d ("net/i40e: fix link down and negotiation")

Applied to dpdk-next-net-intel

Thanks!
Qi