From: Johannes Berg <johannes@sipsolutions.net>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] netlink: add policy attribute range validation
Date: Thu, 27 Sep 2018 10:51:37 +0200 [thread overview]
Message-ID: <1538038297.14416.25.camel@sipsolutions.net> (raw)
In-Reply-To: <20180927084807.GG30601@unicorn.suse.cz>
On Thu, 2018-09-27 at 10:48 +0200, Michal Kubecek wrote:
> We could still use helper macros so this part could become
>
> DEFINE_NLA_U8_RANGE(retry_range, 1, 255);
>
> or
>
> DEFINE_NLA_RANGE(retry_range, u8, 1, 255);
True.
> > policy[] = {
> > ...
> > [NL80211_ATTR_WIPHY_RETRY_SHORT] = {
> > .type = NLA_U8,
> > .validation_data = &retry_range,
> > },
> > ...
> > };
>
> And this could be also shortened using a macro.
>
> It would still be longer but not that much.
Right. You'd still have to name it, and then we'd probably eventually
want to share some common range definitions, but indeed it would work.
> I didn't mean it as a serious objection, rather a note that the gain may
> not be worth the additional complexity.
Sure, and suggestions are very welcome. I was just trying to explain why
I chose this direction, more than anything else.
> But if you want to follow in the
> direction you indicated later (in particular, allowing different
> interpretations of validation_data for the same type), overloading does
> indeed make more sense.
I'm just working on the patches - give me a few more minutes.
johannes
next prev parent reply other threads:[~2018-09-27 8:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-26 20:06 [PATCH] netlink: add policy attribute range validation Johannes Berg
2018-09-26 20:06 ` Johannes Berg
2018-09-26 20:07 ` [RFC] nl80211: use policy range validation where applicable Johannes Berg
2018-09-26 20:09 ` Johannes Berg
2018-09-26 20:17 ` [PATCH] netlink: add policy attribute range validation Johannes Berg
2018-09-26 20:35 ` Johannes Berg
2018-09-26 20:35 ` Johannes Berg
2018-09-27 7:16 ` Michal Kubecek
2018-09-27 8:12 ` Johannes Berg
2018-09-27 8:12 ` Johannes Berg
2018-09-27 8:48 ` Michal Kubecek
2018-09-27 8:48 ` Michal Kubecek
2018-09-27 8:51 ` Johannes Berg [this message]
2018-09-26 20:24 ` Johannes Berg
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=1538038297.14416.25.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.