netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: dsahern@gmail.com
Cc: stephen@networkplumber.org, netdev@vger.kernel.org,
	oss-drivers@netronome.com, jiri@resnulli.us,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH iproute2-next 2/3] devlink: catch missing strings in dl_args_required
Date: Tue,  5 Nov 2019 13:17:06 -0800	[thread overview]
Message-ID: <20191105211707.10300-3-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20191105211707.10300-1-jakub.kicinski@netronome.com>

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(+)

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;
 }
 
-- 
2.23.0


  parent reply	other threads:[~2019-11-05 21:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 21:17 [PATCH iproute2-next 0/3] devlink: improve parameter checking, resources and namespaces Jakub Kicinski
2019-11-05 21:17 ` [PATCH iproute2-next 1/3] devlink: fix referencing namespace by PID Jakub Kicinski
2019-11-06  8:51   ` Jiri Pirko
2019-11-05 21:17 ` Jakub Kicinski [this message]
2019-11-06  8:52   ` [PATCH iproute2-next 2/3] devlink: catch missing strings in dl_args_required Jiri Pirko
2019-11-05 21:17 ` [PATCH iproute2-next 3/3] devlink: allow full range of resource sizes Jakub Kicinski
2019-11-06  8:53   ` Jiri Pirko
2019-11-09  0:40 ` [PATCH iproute2-next 0/3] devlink: improve parameter checking, resources and namespaces David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105211707.10300-3-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=dsahern@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).