-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eal: fix side effect in some pointer arithmetic macros
[ upstream commit 1a7374c ] 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: af75078 ("first public release") 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>
- Loading branch information
1 parent
ac8fea2
commit 48240d7
Showing
2 changed files
with
42 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters