Message ID | 20191105211707.10300-3-jakub.kicinski@netronome.com |
---|---|
State | Accepted |
Delegated to: | David Ahern |
Headers | show |
Series | devlink: improve parameter checking, resources and namespaces | expand |
Tue, Nov 05, 2019 at 10:17:06PM CET, jakub.kicinski@netronome.com wrote: >Currently if dl_args_required doesn't contain a string >for a given option the fact that the option is missing >is silently ignored. > >Add a catch-all case and print a generic error. > >Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Jiri Pirko <jiri@mellanox.com>
diff --git a/devlink/devlink.c b/devlink/devlink.c index 682f832a064c..e05a2336787a 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -1157,6 +1157,10 @@ static int dl_args_finding_required_validate(uint64_t o_required, return -EINVAL; } } + if (o_required & ~o_found) { + pr_err("BUG: unknown argument required but not found\n"); + return -EINVAL; + } return 0; }
Currently if dl_args_required doesn't contain a string for a given option the fact that the option is missing is silently ignored. Add a catch-all case and print a generic error. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> --- devlink/devlink.c | 4 ++++ 1 file changed, 4 insertions(+)