patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: fix build on signed comparison
@ 2024-07-22 10:52 Ferruh Yigit
  2024-07-22 13:26 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ferruh Yigit @ 2024-07-22 10:52 UTC (permalink / raw)
  To: Aman Singh, Sivaprasad Tummala; +Cc: dev, stable, Raslan Darawsheh

Build error:
.../app/test-pmd/config.c: In function 'icmp_echo_config_setup':
.../app/test-pmd/config.c:5159:30:
   error: comparison between signed and unsigned integer expressions
          [-Werror=sign-compare]
  if ((nb_txq * nb_fwd_ports) < nb_fwd_lcores)
                              ^
All 'nb_txq', 'nb_fwd_ports' & 'nb_fwd_lcores' are unsigned variables,
but the warning is related to the integer promotion rules of C:
'nb_txq'       -> uint16_t, promoted to 'int'
'nb_fwd_ports' -> uint16_t, promoted to 'int'
(nb_txq * nb_fwd_ports) -> result 'int'
nb_fwd_lcores  -> 'uint32_t'
Ends up comparing 'int' vs 'uint32_t'.

Fixing by adding the casting back which was initially part of the patch.

Fixes: 2bf44dd14fa5 ("app/testpmd: fix lcore ID restriction")
Cc: stable@dpdk.org

Reported-by: Raslan Darawsheh <rasland@nvidia.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
Cc: sivaprasad.tummala@amd.com
---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 66c3a68c1dc6..6f0beafa271c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5156,7 +5156,7 @@ icmp_echo_config_setup(void)
 	lcoreid_t lc_id;
 	uint16_t  sm_id;
 
-	if ((nb_txq * nb_fwd_ports) < nb_fwd_lcores)
+	if ((lcoreid_t)(nb_txq * nb_fwd_ports) < nb_fwd_lcores)
 		cur_fwd_config.nb_fwd_lcores = (lcoreid_t)
 			(nb_txq * nb_fwd_ports);
 	else
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-22 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-22 10:52 [PATCH] app/testpmd: fix build on signed comparison Ferruh Yigit
2024-07-22 13:26 ` Ferruh Yigit
2024-07-22 16:11 ` Ferruh Yigit
2024-07-22 19:21 ` Ali Alnubani
2024-07-22 21:26   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).