[PATCH] devargs: Fix rte_devargs_parse uninitialized calls

Gaetan Rivet grive at u256.net
Thu Feb 10 18:01:31 CET 2022


The function rte_devargs_parse() previously was safe to call with
non-initialized devargs structure as parameter.

When adding the support for the global device syntax,
this assumption was broken. Restore it by forcing memset as part of
the call itself.

Bugzilla Id: 933
Fixes: b344eb5d941a ("devargs: parse global device syntax")
Signed-off-by: Gaetan Rivet <grive at u256.net>
---
 lib/eal/common/eal_common_devargs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index 8c7650cf6c..184fe676aa 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -191,6 +191,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 
 	if (da == NULL)
 		return -EINVAL;
+	memset(da, 0, sizeof(*da));
 
 	/* First parse according global device syntax. */
 	if (rte_devargs_layers_parse(da, dev) == 0) {
-- 
2.31.1



More information about the dev mailing list