DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/bnxt: harden CPU index validation in stats cache thread
@ 2026-10-05 23:50 Manish Kurup
  0 siblings, 0 replies; only message in thread
From: Manish Kurup @ 2026-10-05 23:50 UTC (permalink / raw)
  To: dev; +Cc: kishore.padmanabha, Mohammad Shuab Siddique

From: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>

Use a < 0 guard instead of == -1 when checking the return values of
ulp_sc_find_free_cpu() and ulp_sc_get_first_dpdk_cpu() before passing
target_cpu to CPU_SET(). Both helpers only ever return -1 today, so
this does not change behavior for the current implementation, but it
makes the non-negative invariant on target_cpu explicit at the
CPU_SET() call site instead of relying on -1 being the only possible
failure value.

Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
index 221b57cbf7..92defadc20 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
@@ -422,9 +422,9 @@ ulp_sc_mgr_thread_start(struct bnxt_ulp_context *ctxt)
 		/* Try to find a free CPU not used by DPDK lcores */
 		target_cpu = ulp_sc_find_free_cpu();
 		/* If no free CPU found, use first CPU from first DPDK lcore */
-		if (target_cpu == -1) {
+		if (target_cpu < 0) {
 			target_cpu = ulp_sc_get_first_dpdk_cpu();
-			if (target_cpu == -1)
+			if (target_cpu < 0)
 				return -ENOENT;
 		}
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-05 23:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 23:50 [PATCH] net/bnxt: harden CPU index validation in stats cache thread Manish Kurup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox