DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/6] cmdline: add null checks for invalid input
  2026-05-07 14:59 [PATCH 0/6] add hardening checks to cmdline and cfgfile libs Bruce Richardson
@ 2026-05-07 14:59 ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2026-05-07 14:59 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

To harden the public API, add some NULL checks before dereferencing
pointers. Properly written apps should never call these with NULL, but
to increase resilience, we'll add the checks.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/cmdline/cmdline.c        | 3 +++
 lib/cmdline/cmdline_rdline.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/lib/cmdline/cmdline.c b/lib/cmdline/cmdline.c
index d1003f0b8e..51fbc36cef 100644
--- a/lib/cmdline/cmdline.c
+++ b/lib/cmdline/cmdline.c
@@ -103,6 +103,9 @@ RTE_EXPORT_SYMBOL(cmdline_get_rdline)
 struct rdline*
 cmdline_get_rdline(struct cmdline *cl)
 {
+	if (!cl)
+		return NULL;
+
 	return &cl->rdl;
 }
 
diff --git a/lib/cmdline/cmdline_rdline.c b/lib/cmdline/cmdline_rdline.c
index 0a5a399b32..15da285c8d 100644
--- a/lib/cmdline/cmdline_rdline.c
+++ b/lib/cmdline/cmdline_rdline.c
@@ -618,6 +618,9 @@ RTE_EXPORT_SYMBOL(rdline_get_history_buffer_size)
 size_t
 rdline_get_history_buffer_size(struct rdline *rdl)
 {
+	if (!rdl)
+		return 0;
+
 	return sizeof(rdl->history_buf);
 }
 
-- 
2.51.0


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

* Re: [PATCH 6/6] cmdline: add null checks for invalid input
@ 2026-05-07 22:25 Alex Michael
  2026-05-08  7:41 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Michael @ 2026-05-07 22:25 UTC (permalink / raw)
  To: bruce.richardson; +Cc: dev

pmd_buffer_scatter test suite failed on Ubuntu 24.04 LTS with an Intel XL710 40GbE NIC. Conversely it didn’t fail on Ubuntu 22.04 with an Intel E810 NIC, so the issue lies either with the OS (mbuf size or mempool configuration mismatch / buffer handling logic), the NIC (driver-level bug), the interaction between them or the test suite itself (as it should be unrelated to NULL conditionals).

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

* Re: [PATCH 6/6] cmdline: add null checks for invalid input
  2026-05-07 22:25 [PATCH 6/6] cmdline: add null checks for invalid input Alex Michael
@ 2026-05-08  7:41 ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2026-05-08  7:41 UTC (permalink / raw)
  To: Alex Michael; +Cc: dev

On Thu, May 07, 2026 at 06:25:25PM -0400, Alex Michael wrote:
> pmd_buffer_scatter test suite failed on Ubuntu 24.04 LTS with an Intel XL710 40GbE NIC. Conversely it didn’t fail on Ubuntu 22.04 with an Intel E810 NIC, so the issue lies either with the OS (mbuf size or mempool configuration mismatch / buffer handling logic), the NIC (driver-level bug), the interaction between them or the test suite itself (as it should be unrelated to NULL conditionals).

Agree. The test failure seem unrelated to this patchset.

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

end of thread, other threads:[~2026-05-12  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 22:25 [PATCH 6/6] cmdline: add null checks for invalid input Alex Michael
2026-05-08  7:41 ` Bruce Richardson
  -- strict thread matches above, loose matches on Subject: below --
2026-05-07 14:59 [PATCH 0/6] add hardening checks to cmdline and cfgfile libs Bruce Richardson
2026-05-07 14:59 ` [PATCH 6/6] cmdline: add null checks for invalid input Bruce Richardson

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