[PATCH 00/71] replace use of fixed size rte_memcpy
David Marchand
david.marchand at redhat.com
Fri Mar 1 14:53:48 CET 2024
Hello Stephen,
On Fri, Mar 1, 2024 at 12:00 AM Stephen Hemminger
<stephen at networkplumber.org> 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.
There is a build issue reported by the CI, please fix and submit a new revision.
--
David Marchand
More information about the dev
mailing list