From: Beilei Xing Date: Wed, 23 May 2018 07:46:46 +0000 (+0800) Subject: net/i40e: fix shifts of 32-bit value X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=bc98bf3a2d0301a17707bc04e95fc32746a397c4;p=dpdk.git 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") Cc: stable@dpdk.org Signed-off-by: Beilei Xing Acked-by: Qi Zhang --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 13c5d32963..9f80e70ce0 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -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 */