A device given in the global syntax without a driver layer,
e.g. "bus=vdev,name=net_af_packet0", leaves drv_str,
and so args which shares its union, set to NULL.
The legacy syntax always sets args, to an empty string when there
are no options, and drivers rely on that.
Passing NULL to rte_kvargs_parse() crashes in strdup().
Default drv_str to an empty string when there is no driver layer.
Bugzilla ID: 2049
Fixes: b344eb5d941a ("devargs: parse global device syntax")
Cc: [email protected]
Signed-off-by: Stephen Hemminger <[email protected]>
---
lib/eal/common/eal_common_devargs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/eal/common/eal_common_devargs.c
b/lib/eal/common/eal_common_devargs.c
index c523429d67..8bbff9cd15 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -154,6 +154,10 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
}
}
+ /* No driver layer: match the legacy syntax, empty args. */
+ if (devargs->drv_str == NULL)
+ devargs->drv_str = "";
+
/* Resolve devargs name. */
if (devargs->bus != NULL && devargs->bus->devargs_parse != NULL)
ret = devargs->bus->devargs_parse(devargs);
--
2.53.0