Message ID | 09890143926c494e1cc3939a84eded4c55c27d9e.1618350667.git.aclaudi@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Stephen Hemminger |
Headers | show |
Series | [iproute2] devlink: always check strslashrsplit() return value | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/devlink/devlink.c b/devlink/devlink.c index c6e85ff9..faa87b3d 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -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; }
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: 2f85a9c53587 ("devlink: allow to parse both devlink and port handle in the same time") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> --- devlink/devlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)