The expression: if ((socketid = rte_lcore_to_socket_id(lcore) != 0) &&
gets evaluated as sockeid = (rte_lcore_to_socket_id(lcore) != 0) which is not what was intended. This is goes all the way back to first release. Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ Fixes: af75078fece3 ("first public release") Cc: [email protected] Signed-off-by: Stephen Hemminger <[email protected]> --- examples/l3fwd-power/main.c | 4 ++-- examples/l3fwd/main.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index d279e664b3..e27b8531b5 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1412,8 +1412,8 @@ check_lcore_params(void) "mask\n", lcore); return -1; } - if ((socketid = rte_lcore_to_socket_id(lcore) != 0) && - (numa_on == 0)) { + socketid = rte_lcore_to_socket_id(lcore); + if (socketid != 0 && numa_on == 0) { printf("warning: lcore %u is on socket %d with numa " "off\n", lcore, socketid); } diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 994b7dd8e5..ae3b4f6439 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -311,8 +311,9 @@ check_lcore_params(void) printf("error: lcore %u is not enabled in lcore mask\n", lcore); return -1; } - if ((socketid = rte_lcore_to_socket_id(lcore) != 0) && - (numa_on == 0)) { + + socketid = rte_lcore_to_socket_id(lcore); + if (socketid != 0 && numa_on == 0) { printf("warning: lcore %u is on socket %d with numa off\n", lcore, socketid); } -- 2.47.2

