提交 6186ddf0 编写于 作者: J Jacob Keller 提交者: Jeff Kirsher

fm10k: use ether_addr_equal instead of memcmp

When comparing MAC addresses, use ether_addr_equal instead of memcmp to
ETH_ALEN length. Found and replaced using the following sed:

 sed -e 's/memcmp\x28\(.*\), ETH_ALEN\x29/!ether_addr_equal\x28\1\x29/'
Reported-by: NBruce Allan <bruce.w.allan@intel.com>
Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
Reviewed-by: NBruce Allan <bruce.w.allan@intel.com>
Tested-by: NKrishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 09f8a82b
...@@ -1191,7 +1191,7 @@ static s32 fm10k_mbx_mac_addr(struct fm10k_hw *hw, u32 **results, ...@@ -1191,7 +1191,7 @@ static s32 fm10k_mbx_mac_addr(struct fm10k_hw *hw, u32 **results,
/* MAC was changed so we need reset */ /* MAC was changed so we need reset */
if (is_valid_ether_addr(hw->mac.perm_addr) && if (is_valid_ether_addr(hw->mac.perm_addr) &&
memcmp(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN)) !ether_addr_equal(hw->mac.perm_addr, hw->mac.addr))
interface->flags |= FM10K_FLAG_RESET_REQUESTED; interface->flags |= FM10K_FLAG_RESET_REQUESTED;
/* VLAN override was changed, or default VLAN changed */ /* VLAN override was changed, or default VLAN changed */
......
...@@ -1250,7 +1250,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results, ...@@ -1250,7 +1250,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
/* block attempts to set MAC for a locked device */ /* block attempts to set MAC for a locked device */
if (is_valid_ether_addr(vf_info->mac) && if (is_valid_ether_addr(vf_info->mac) &&
memcmp(mac, vf_info->mac, ETH_ALEN)) !ether_addr_equal(mac, vf_info->mac))
return FM10K_ERR_PARAM; return FM10K_ERR_PARAM;
set = !(vlan & FM10K_VLAN_CLEAR); set = !(vlan & FM10K_VLAN_CLEAR);
......
...@@ -755,7 +755,7 @@ s32 fm10k_tlv_msg_test(struct fm10k_hw *hw, u32 **results, ...@@ -755,7 +755,7 @@ s32 fm10k_tlv_msg_test(struct fm10k_hw *hw, u32 **results,
err = fm10k_tlv_attr_get_mac_vlan( err = fm10k_tlv_attr_get_mac_vlan(
results[FM10K_TEST_MSG_MAC_ADDR], results[FM10K_TEST_MSG_MAC_ADDR],
result_mac, &result_vlan); result_mac, &result_vlan);
if (!err && memcmp(test_mac, result_mac, ETH_ALEN)) if (!err && !ether_addr_equal(test_mac, result_mac))
err = FM10K_ERR_INVALID_VALUE; err = FM10K_ERR_INVALID_VALUE;
if (!err && test_vlan != result_vlan) if (!err && test_vlan != result_vlan)
err = FM10K_ERR_INVALID_VALUE; err = FM10K_ERR_INVALID_VALUE;
......
...@@ -298,7 +298,7 @@ static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort, ...@@ -298,7 +298,7 @@ static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,
/* verify we are not locked down on the MAC address */ /* verify we are not locked down on the MAC address */
if (is_valid_ether_addr(hw->mac.perm_addr) && if (is_valid_ether_addr(hw->mac.perm_addr) &&
memcmp(hw->mac.perm_addr, mac, ETH_ALEN)) !ether_addr_equal(hw->mac.perm_addr, mac))
return FM10K_ERR_PARAM; return FM10K_ERR_PARAM;
/* add bit to notify us if this is a set or clear operation */ /* add bit to notify us if this is a set or clear operation */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册