]> git.droids-corp.org - dpdk.git/commit
eal/x86: fix unaligned access for small memcpy
authorLuc Pelletier <lucp.at.work@gmail.com>
Fri, 25 Feb 2022 16:38:05 +0000 (11:38 -0500)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 19 May 2022 16:19:30 +0000 (18:19 +0200)
commit00901e4d1a9ee7c7b43d0a3592683f0a420a331d
treef49af35f49ba1aab511b075c63d75881d84e8534
parent04e53de9e5406d7fc177da2c3f886709268ec466
eal/x86: fix unaligned access for small memcpy

Calls to rte_memcpy for 1 < n < 16 could result in unaligned
loads/stores, which is undefined behaviour according to the C
standard, and strict aliasing violations.

The code was changed to use a packed structure that allows aliasing
(using the __may_alias__ attribute) to perform the load/store
operations. This results in code that has the same performance as the
original code and that is also C standards-compliant.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Luc Pelletier <lucp.at.work@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/eal/include/rte_common.h
lib/eal/x86/include/rte_memcpy.h