[PATCH 00/71] replace use of fixed size rte_memcpy
Bruce Richardson
bruce.richardson at intel.com
Fri Mar 1 09:38:26 CET 2024
On Thu, Feb 29, 2024 at 02:57:47PM -0800, Stephen Hemminger wrote:
> The DPDK has a lot of "cargo cult" usage of rte_memcpy.
> This patch set replaces cases where rte_memcpy is used with a fixed
> size constant size.
>
> Typical example is:
> rte_memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN);
> which can be replaced with:
> memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN);
>
> This has two benefits. Gcc (and clang) are smart enough that for
> all small fixed size values, they just generate the necessary instructions
> to do it inline. It also means that fortify, Coverity, and ASAN
> analyzers can check these memcpy's.
>
> So faster, better, safer.
>
> The first patch is a simple coccinelle script to do the replacement
> and the rest are the results broken out by module.
>
> The coccinelle script can be used again to make sure more bad
> usage doesn't creep in with new drivers.
>
Thanks for this Stephen.
Series-acked-by: Bruce Richardson <bruce.richardson at intel.com>
More information about the dev
mailing list