|SUCCESS| net/zxdh: replace memcpy with structure assignment

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Apr 1 23:30:56 CEST 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/162818

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-01

git sha: series.patch (from patchwork)
Author: Stephen Hemminger <stephen at networkplumber.org>
Subject: [PATCH] net/zxdh: replace memcpy with structure assignment

This patch replaces rte_memcpy() with direct structure assignment for
copying struct zxdh_flow, which is a good cleanup as structure assignment
is more idiomatic and potentially more efficient for small structures.

> diff --git a/drivers/net/zxdh/zxdh_flow.c b/drivers/net/zxdh/zxdh_flow.c
> index 7a2e20ac39..56ac34c6e3 100644
> --- a/drivers/net/zxdh/zxdh_flow.c
> +++ b/drivers/net/zxdh/zxdh_flow.c
> @@ -1884,7 +1884,7 @@ vf_flow_msg_process(enum zxdh_msg_type msg_type, struct rte_eth_dev *dev,
>  	struct zxdh_flow_op_rsp *flow_rsp = (struct zxdh_flow_op_rsp *)flow_op_rsp;
>  
>  	dh_flow->hash_search_index = hw->hash_search_index;
> -	rte_memcpy(&flow_msg->dh_flow, dh_flow, sizeof(struct zxdh_flow));
> +	flow_msg->dh_flow = *dh_flow;

Does this handle the alignment properly? If dh_flow is not properly
aligned for the structure type, could the dereference *dh_flow cause
undefined behavior? The original rte_memcpy() would handle unaligned
pointers safely.

Can struct zxdh_flow be confirmed to have no padding bytes that might
contain uninitialized data? With memcpy, the padding bytes are copied
directly, but with structure assignment, the compiler might not copy
padding, which could be a concern if the structure is later serialized
or hashed.

>  
>  	zxdh_msg_head_build(hw, msg_type, &msg_info);
>  	ret = zxdh_vf_send_msg_to_pf(dev, &msg_info, sizeof(struct zxdh_msg_info),


More information about the test-report mailing list