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

