From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BA5645CD8 for ; Mon, 18 Nov 2024 19:22:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DD05432D6; Mon, 18 Nov 2024 19:22:29 +0100 (CET) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by mails.dpdk.org (Postfix) with ESMTP id B2A8842DD5 for ; Mon, 18 Nov 2024 19:22:19 +0100 (CET) Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7f809332ffcso3115507a12.0 for ; Mon, 18 Nov 2024 10:22:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954139; x=1732558939; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=REPLojYG24mGrz9ru9fESpsphl8S8r6uIwwr2ioreVI=; b=B4lxt64xdleWderb8G5wByQhGiODAbLS/THvRkXG9PJ34evdl02/fhNbcoAaxJTQOn p5FKttrgrCvUvubavLsIvcYxmnNi1ndEzPBJ3EhM3gOOI+bzJtnzzyMeff+diBfVMVwq 736/7WfRdVADoQGYvj/0KDz9CVI7biVUAl03f1zXLWfHtVK6vsTdfHDeOuEm2Ge2RVSL kc/yhEQjgJ9h8VKgqVtkqYZVyKu7RyvdeKpGr9KEanF8l58WKO8RI3Rh2QKh3D8hcD6z yWOG8TyniqEe98Jn9XOnknx5Qw2IR92g12qzfJHOp6lYHl7hUvtugy413H2Dyz8g3Coz pdmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954139; x=1732558939; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=REPLojYG24mGrz9ru9fESpsphl8S8r6uIwwr2ioreVI=; b=X1tYV8UmfRr3a5QgPkA8LqOI74wDTs70Q/LfTWBLKj3Zv4FbnDinWvwRTG+KBxHFS7 UQGVs3YXuQbZfKYzAOIp5mns5bDwQo4xg61dWK8kVO6D/ylxUfJ17Hxm7qxB0P5fPYjw TbuLXcQwfsA3LTGK91hU/uI0kpl5Xkwx1OnwtH4NX4SWQlxune0BXu+NjXqhBX0OHZme SdTRdBx4c5wWUwxX2k7wXangaoC6HvFMThqzFDzaWytYXFaNEKhSK6owK/YE4EUEhL9t 4yYefysN4O9FQJ/1jzOa0iurk68Fz8Ij1IJNwTlG1pY2f6dDsgFwTXgBm5Zldd4vbOhh EGHA== X-Forwarded-Encrypted: i=1; AJvYcCU2EE0o5tS6ehu8fGKC823IucaXygIVJQH4exVrefd8E/Eq8nx1WBf2zoZYT2WoOdDDRfyIplU=@dpdk.org X-Gm-Message-State: AOJu0YznOhC7EXv93lWZnRW2jKQ53fH+eMPapqBjvCVwPNI0WCPFb1S2 ZN9X4NscsjseyIk6dwzZG7qfpjX1XnoYLfitZ9SCUDa1i51SvAmmnORgKnoPzfY= X-Google-Smtp-Source: AGHT+IFWx+MVhRO256Kp7jDqk5nELsKfWoCEyOJAg0t5R7BjPPXW99Lmjpd1Vs5q5H1YSfuEEKryhQ== X-Received: by 2002:a17:90b:4f41:b0:2ea:9e36:980e with SMTP id 98e67ed59e1d1-2eaaa7e793emr467473a91.13.1731954137395; Mon, 18 Nov 2024 10:22:17 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea61869bb2sm2916724a91.12.2024.11.18.10.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:17 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org Subject: [PATCH v2 18/19] examples/l3fwd: fix operator precedence bugs Date: Mon, 18 Nov 2024 10:20:59 -0800 Message-ID: <20241118182153.87042-19-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118182153.87042-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> <20241118182153.87042-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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: stable@dpdk.org Signed-off-by: Stephen Hemminger --- 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