numam-dpdk/lib/eal
Dmitry Kozlyuk 1a7374c956 eal: fix side effect in some pointer arithmetic macros
RTE_PTR_SUB(ptr, x) and RTE_PTR_ALIGN_FLOOR() worked incorrectly
if "ptr" was an expression:

    uint32_t arr[3];

    RTE_PTR_SUB(arr + 1, sizeof(arr[0]));
    // expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr
    // actual:   (uint32_t *)((uintptr_t) arr + 1  - 4) != arr

    RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0]));
    // expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2]
    // actual:   RTE_ALIGN_FLOOR((uintptr_t) arr + 2,  4) == &arr[0]

Fix the macros and extend the relevant unit test.
Convert uses of a custom test failure macro to RTE_TEST_ASSERT*().

Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
2022-09-21 15:31:03 +02:00
..
arm eal: remove unused arch-specific headers for locks 2022-06-08 15:44:20 +02:00
common service: fix lingering active status 2022-07-05 16:24:43 +02:00
freebsd eal/unix: make stack dump signal safe 2022-06-23 13:40:50 +02:00
include eal: fix side effect in some pointer arithmetic macros 2022-09-21 15:31:03 +02:00
linux eal/linux: allocate worker lcore stacks in hugepages 2022-06-23 22:36:33 +02:00
ppc eal: remove unused arch-specific headers for locks 2022-06-08 15:44:20 +02:00
riscv eal/riscv: fix vector header for C++ 2022-06-15 09:12:16 +02:00
unix eal/unix: make stack dump signal safe 2022-06-23 13:40:50 +02:00
windows eal: get/set thread priority per thread identifier 2022-06-07 13:33:14 +02:00
x86 eal/x86: drop export of internal alignment macro 2022-06-22 11:32:35 +02:00
meson.build eal: add OS defines for C conditional checks 2022-01-17 19:26:42 +01:00
version.map version: 22.11-rc0 2022-07-21 12:13:48 +02:00