[PATCH v2 16/68] ethdev: replace use of rte_memcpy
fengchengwen
fengchengwen at huawei.com
Mon Aug 24 05:02:58 CEST 2026
Reviewed-by: Chengwen Feng <fengchengwen at huawei.com>
On 8/22/2026 3:24 AM, Stephen Hemminger wrote:
> The management of flows is better done using memcpy() or
> structure assignment where compiler can do more bounds checks.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
> lib/ethdev/rte_ethdev.c | 3 +-
> lib/ethdev/rte_flow.c | 104 ++++++++++++++++++----------------------
> 2 files changed, 47 insertions(+), 60 deletions(-)
>
...
> if (src->pattern_ro) {
> @@ -1138,9 +1128,7 @@ rte_flow_conv(enum rte_flow_conv_op op,
> break;
> case RTE_FLOW_CONV_OP_ATTR:
> attr = src;
> - if (size > sizeof(*attr))
> - size = sizeof(*attr);
> - rte_memcpy(dst, attr, size);
> + memcpy(dst, attr, RTE_MIN(size, sizeof(*attr)));
The size will be used later: rte_flow_trace_conv(op, dst, size, src, ret);
In the new impl, the size was not updated, I think it should use the original
size other than modified in the trace.
> ret = sizeof(*attr);
> break;
> case RTE_FLOW_CONV_OP_ITEM:
...
>
More information about the dev
mailing list