[24/32] net/bnx2x: replace memcpy with structure assignment

Message ID 20250208203142.242284-25-stephen@networkplumber.org (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series Use structure assignment instead of memcpy |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 8, 2025, 8:22 p.m. UTC
Prefer structure assignment over memcpy.
Found by struct-assign.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c
index 8adbe7e381..b14139c052 100644
--- a/drivers/net/bnx2x/bnx2x_stats.c
+++ b/drivers/net/bnx2x/bnx2x_stats.c
@@ -805,7 +805,7 @@  bnx2x_hw_stats_update(struct bnx2x_softc *sc)
 				  etherstatspktsover1522octets);
 	}
 
-	memcpy(old, new, sizeof(struct nig_stats));
+	*old = *new;
 
 	memcpy(RTE_PTR_ADD(estats, offsetof(struct bnx2x_eth_stats, rx_stat_ifhcinbadoctets_hi)),
 	       &pstats->mac_stx[1], sizeof(struct mac_stx));