Skip to content

Commit

Permalink
raw/skeleton: fix empty devargs parsing
Browse files Browse the repository at this point in the history
[ upstream commit 11da6149224a8de53d2ddd2aacba7b158cc4e3b4 ]

The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.

This patch fixes segment fault when parse input args with 'only keys'
(e.g. self_test).

Fixes: 55ca1b0 ("raw/skeleton: add test cases")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
  • Loading branch information
fengchengwen authored and bluca committed Mar 15, 2023
1 parent 279024f commit bbedd03
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/raw/skeleton/skeleton_rawdev.c
Expand Up @@ -659,6 +659,8 @@ skeldev_get_selftest(const char *key __rte_unused,
void *opaque)
{
int *flag = opaque;
if (value == NULL || opaque == NULL)
return -EINVAL;
*flag = atoi(value);
return 0;
}
Expand Down

0 comments on commit bbedd03

Please sign in to comment.