fm10k: use ether_addr_equal instead of memcmp
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 16 Nov 2015 23:33:34 +0000 (15:33 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 22 Dec 2015 13:01:58 +0000 (05:01 -0800)
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: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k_pci.c
drivers/net/ethernet/intel/fm10k/fm10k_pf.c
drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
drivers/net/ethernet/intel/fm10k/fm10k_vf.c

index 202468f07edece5c7dfd38896e1c0276548d8f92..9c6ed8855abe0872ebdcbd191c90dca4b30d0217 100644 (file)
@@ -1191,7 +1191,7 @@ static s32 fm10k_mbx_mac_addr(struct fm10k_hw *hw, u32 **results,
 
        /* MAC was changed so we need reset */
        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;
 
        /* VLAN override was changed, or default VLAN changed */
index 808307e677187c9ffb00eeb9060eb8880d100ec5..7dd7ca8fa2bbb274e3c3a6791c287205b063029c 100644 (file)
@@ -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 */
                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;
 
                set = !(vlan & FM10K_VLAN_CLEAR);
index 95afb5c0c9c4c815b7043710ec0ff25c090b3db3..ab01bb30752f9886c530de8648473d95622e7eda 100644 (file)
@@ -755,7 +755,7 @@ parse_nested:
                err = fm10k_tlv_attr_get_mac_vlan(
                                        results[FM10K_TEST_MSG_MAC_ADDR],
                                        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;
                if (!err && test_vlan != result_vlan)
                        err = FM10K_ERR_INVALID_VALUE;
index 5445c0fab49f2ad9073ba4bf507ebc9af6e299fd..f1dc6e818730a70d1360e92fe81553872ab26cc8 100644 (file)
@@ -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 */
        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;
 
        /* add bit to notify us if this is a set or clear operation */