Skip to contentSkip to conversation

sfc: Replace memset with eth_zero_addr

PATCH In review Lucas Tanure 4 participants 5 messages Jan 19, 2016 – Jan 20, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sfc: Replace memset with eth_zero_addr

Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero.

---
 drivers/net/ethernet/sfc/ef10_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sfc/ef10_sriov.c +1 -1
index 3c17f27..10f60db 100644
@@ -527,7 +527,7 @@ int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
 	return 0;
 
 fail:
-	memset(vf->mac, 0, ETH_ALEN);
+	eth_zero_addr(vf->mac);
 	return rc;
 }
 
Signature · 1 line
2.7.0
#3 lore raw
In reply to Lucas Tanure

Hello.

Quoted 2 lines · Lucas Tanure

Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero.

What address? memset() takes just 1 address. :-)

Quoted 10 lines
---
  drivers/net/ethernet/sfc/ef10_sriov.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sfc/ef10_sriov.c +0 -0
index 3c17f27..10f60db 100644

drivers/net/ethernet/sfc/ef10_sriov.c int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac) · line 533

Quoted 8 lines
drivers/net/ethernet/sfc/ef10_sriov.c +1 -1
@@ -527,7 +527,7 @@ int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
  	return 0;
 
  fail:
-	memset(vf->mac, 0, ETH_ALEN);
+	eth_zero_addr(vf->mac);
  	return rc;
  }
 

MBR, Sergei

#4 lore raw

Hi,

Quoted 9 lines · Sergei Shtylyov

Hello.

Quoted 2 lines · Lucas Tanure

Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero.

What address? memset() takes just 1 address. :-)

I mean the vf->mac, a pointer to a six-byte array containing the Ethernet address.

Quoted 15 lines
Quoted 15 lines
---
  drivers/net/ethernet/sfc/ef10_sriov.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sfc/ef10_sriov.c +0 -0
index 3c17f27..10f60db 100644
@@ -527,7 +527,7 @@ int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int
 vf_i, u8 *mac)
        return 0;
 
Quoted 9 lines

drivers/net/ethernet/sfc/ef10_sriov.c int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac) · line 532

Quoted 6 lines
drivers/net/ethernet/sfc/ef10_sriov.c +1 -1
  fail:
-       memset(vf->mac, 0, ETH_ALEN);
+       eth_zero_addr(vf->mac);
        return rc;
  }

MBR, Sergei

Thanks, Tanure