devlink: always check strslashrsplit() return value

strslashrsplit() return value is not checked in __dl_argv_handle(),
despite the fact that it can return EINVAL.

This commit fix it and make __dl_argv_handle() return error if
strslashrsplit() return an error code.

Fixes: 2f85a9c535 ("devlink: allow to parse both devlink and port handle in the same time")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Andrea Claudi 2021-04-14 00:48:37 +02:00 committed by Stephen Hemminger
parent cc718c191b
commit 6b8fa2ea2d
1 changed files with 7 additions and 1 deletions

View File

@ -965,7 +965,13 @@ static int strtobool(const char *str, bool *p_val)
static int __dl_argv_handle(char *str, char **p_bus_name, char **p_dev_name)
{
strslashrsplit(str, p_bus_name, p_dev_name);
int err;
err = strslashrsplit(str, p_bus_name, p_dev_name);
if (err) {
pr_err("Devlink identification (\"bus_name/dev_name\") \"%s\" is invalid\n", str);
return err;
}
return 0;
}