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: sta...@dpdk.org Signed-off-by: Stephen Hemminger <step...@networkplumber.org> --- 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 ae8b55924e..7957ea6c95 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 6e2155e005..14076e07cc 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -307,8 +307,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.45.2