Skip to contentSkip to conversation

scsi: fnic: Replace memset with eth_zero_addr

PATCH Applied Chen Ni 3 participants 4 messages May 19, 2025 – May 28, 2025

Subsystems (2)
lore
Share & tools
lore

Chen Ni

author
#0 lore raw

PATCH 1/1 scsi: fnic: 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/scsi/fnic/fip.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/fnic/fip.c +4 -4
index 6e7c0b00eb41..19395e2aee44 100644
@@ -200,7 +200,7 @@ void fnic_fcoe_start_fcf_discovery(struct fnic *fnic)
 		return;
 	}
 
-	memset(iport->selected_fcf.fcf_mac, 0, ETH_ALEN);
+	eth_zero_addr(iport->selected_fcf.fcf_mac);
 
 	pdisc_sol = (struct fip_discovery *) frame;
 	*pdisc_sol = (struct fip_discovery) {
@@ -588,12 +588,12 @@ void fnic_common_fip_cleanup(struct fnic *fnic)
 	if (!is_zero_ether_addr(iport->fpma))
 		vnic_dev_del_addr(fnic->vdev, iport->fpma);
 
-	memset(iport->fpma, 0, ETH_ALEN);
+	eth_zero_addr(iport->fpma);
 	iport->fcid = 0;
 	iport->r_a_tov = 0;
 	iport->e_d_tov = 0;
-	memset(fnic->iport.fcfmac, 0, ETH_ALEN);
-	memset(iport->selected_fcf.fcf_mac, 0, ETH_ALEN);
+	eth_zero_addr(fnic->iport.fcfmac);
+	eth_zero_addr(iport->selected_fcf.fcf_mac);
 	iport->selected_fcf.fcf_priority = 0;
 	iport->selected_fcf.fka_adv_period = 0;
 	iport->selected_fcf.ka_disabled = 0;
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 39 lines · Chen Ni

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/scsi/fnic/fip.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/fnic/fip.c +4 -5
index 6e7c0b00eb41..19395e2aee44 100644
@@ -200,7 +200,7 @@ void fnic_fcoe_start_fcf_discovery(struct fnic *fnic)
 return;
 }
 
-     memset(iport->selected_fcf.fcf_mac, 0, ETH_ALEN);
+     eth_zero_addr(iport->selected_fcf.fcf_mac);
 
 pdisc_sol = (struct fip_discovery *) frame;
 *pdisc_sol = (struct fip_discovery) {
@@ -588,12 +588,12 @@ void fnic_common_fip_cleanup(struct fnic *fnic)
 if (!is_zero_ether_addr(iport->fpma))
 vnic_dev_del_addr(fnic->vdev, iport->fpma);
 
-     memset(iport->fpma, 0, ETH_ALEN);
+     eth_zero_addr(iport->fpma);
 iport->fcid = 0;
 iport->r_a_tov = 0;
 iport->e_d_tov = 0;
-     memset(fnic->iport.fcfmac, 0, ETH_ALEN);
-     memset(iport->selected_fcf.fcf_mac, 0, ETH_ALEN);
+     eth_zero_addr(fnic->iport.fcfmac);
+     eth_zero_addr(iport->selected_fcf.fcf_mac);
 iport->selected_fcf.fcf_priority = 0;
 iport->selected_fcf.fka_adv_period = 0;
 iport->selected_fcf.ka_disabled = 0;
--
Quoted 3 lines

2.25.1

Hi Chen,

Thanks for these changes.
They look good to me.

Regards,
Karan

#2 lore raw
In reply to Chen Ni

Chen,

Quoted 2 lines

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

Applied to 6.16/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen