DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] fix crash on device args with no driver options
@ 2026-10-05 16:53 Stephen Hemminger
  2026-10-05 16:53 ` [PATCH 1/4] devargs: fix NULL args with global device syntax Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stephen Hemminger @ 2026-10-05 16:53 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

A device given in the global syntax with no driver layer, such as
"bus=vdev,name=net_af_packet0", leaves devargs args NULL because
drv_str shares a union with it and is never set.  The legacy syntax
always sets args, to an empty string when there are no options, and
drivers rely on that.  Passing the NULL to rte_kvargs_parse() crashes
in strdup().

The first patch makes the global syntax match the legacy one by
defaulting to an empty string.  The second hardens rte_kvargs_parse()
so a NULL gives an empty list rather than a crash; NULL is not
excluded by the API documentation, and an empty list is the sensible
reading of "no arguments".

The last two patches add the missing coverage.  There was no test for
a device string without driver arguments, which is how this went
unnoticed.  Converting the devargs test to the unit test suite runner
comes first so the new case is reported on its own rather than
short-circuiting the rest of the file.

Verified both new tests fail without the fixes: the devargs case trips
its args-NULL assertion, and the kvargs case faults in strdup().

Bugzilla ID: 2049

Stephen Hemminger (4):
  devargs: fix NULL args with global device syntax
  kvargs: harden rte_kvargs_parse
  test/devargs: use unit test suite runner
  test/devargs: add tests for missing device arguments

 app/test/test_devargs.c             | 101 ++++++++++++++++++++++------
 app/test/test_kvargs.c              |  16 +++++
 lib/eal/common/eal_common_devargs.c |   4 ++
 lib/kvargs/rte_kvargs.c             |   6 +-
 4 files changed, 106 insertions(+), 21 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-10-05 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 16:53 [PATCH 0/4] fix crash on device args with no driver options Stephen Hemminger
2026-10-05 16:53 ` [PATCH 1/4] devargs: fix NULL args with global device syntax Stephen Hemminger
2026-10-05 16:53 ` [PATCH 2/4] kvargs: harden rte_kvargs_parse Stephen Hemminger
2026-10-05 16:53 ` [PATCH 3/4] test/devargs: use unit test suite runner Stephen Hemminger
2026-10-05 16:53 ` [PATCH 4/4] test/devargs: add tests for missing device arguments Stephen Hemminger

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