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

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Apr 1 23:09:26 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

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

This patch replaces a rte_memcpy() call with direct structure assignment
when copying struct zxdh_flow.

> 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 code contain a use-after-free issue? In vf_flow_msg_process(),
dh_flow->hash_search_index is assigned from hw->hash_search_index, then
the entire dh_flow structure (including the just-assigned hash_search_index)
is copied into flow_msg->dh_flow. If dh_flow points to stack memory or is
freed shortly after this function, does flow_msg->dh_flow retain a valid
copy?

The original rte_memcpy() and the new structure assignment both perform
a shallow copy. Can this cause issues if struct zxdh_flow contains
pointers to dynamically allocated memory? If dh_flow is later freed along
with any pointed-to resources, does flow_msg->dh_flow end up with dangling
pointers?


More information about the test-report mailing list