From: Jiri Pirko <jiri@resnulli•us>
To: Jamal Hadi Salim <jhs@mojatatu•com>
Cc: davem@davemloft•net, netdev@vger•kernel.org,
xiyou.wangcong@gmail•com, dsahern@gmail•com,
eric.dumazet@gmail•com, mrv@mojatatu•com,
simon.horman@netronome•com, alex.aring@gmail•com
Subject: Re: [PATCH net-next v11 3/4] net sched actions: dump more than TCA_ACT_MAX_PRIO actions per batch
Date: Fri, 28 Jul 2017 17:45:47 +0200 [thread overview]
Message-ID: <20170728154547.GG1857@nanopsycho> (raw)
In-Reply-To: <fc91ce4d-b7d1-7e95-7e9a-9265aed68424@mojatatu.com>
Fri, Jul 28, 2017 at 05:08:10PM CEST, jhs@mojatatu•com wrote:
>On 17-07-28 10:52 AM, Jamal Hadi Salim wrote:
>> On 17-07-28 10:12 AM, Jiri Pirko wrote:
>> > Fri, Jul 28, 2017 at 03:41:44PM CEST, jhs@mojatatu•com wrote:
>> [..]
>> >
>> > Looks like a big mess to be honest. Mixing up u32* u32 void*. I don't
>> > understand ****. Would be probably good to first apply my review comment
>> > on the function itselt, then to add the checks :)
>> >
>>
>> I havent even compiled/test that Jiri.
>> Just ignore the void * and assume it is a u32 *.
>>
>
>This compiled - but dont have much time right now to test.
>===
>static int validate_nla_bitfield32(const struct nlattr *nla,
> u32 *valid_flags_allowed)
>{
> const struct nla_bitfield32 *bf = nla_data(nla);
> u32 *valid_flags_mask = valid_flags_allowed;
good one :D
>
> if (!valid_flags_allowed)
> return -EINVAL;
>
> /*disallow invalid selector */
> if ((bf->selector & *valid_flags_allowed) > *valid_flags_allowed)
I don't get the ">"....
Just (bf->selector & ~*valid_flags_allowed) should be enought, no?
> return -EINVAL;
>
> /*disallow invalid bit values */
> if (bf->value & ~*valid_flags_mask)
> return -EINVAL;
>
> /*disallow valid bit values that are not selected*/
> if (bf->value & ~bf->selector)
> return -EINVAL;
>
> return 0;
>}
>========
>
>cheers,
>jamal
next prev parent reply other threads:[~2017-07-28 15:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 1:35 [PATCH net-next v11 0/4] net sched actions: improve dump performance Jamal Hadi Salim
2017-07-24 1:35 ` [PATCH net-next v11 1/4] net netlink: Add new type NLA_BITFIELD_32 Jamal Hadi Salim
2017-07-24 11:14 ` Jiri Pirko
2017-07-25 11:14 ` Jamal Hadi Salim
2017-07-24 11:18 ` Jiri Pirko
2017-07-25 11:15 ` Jamal Hadi Salim
2017-07-25 14:41 ` David Ahern
2017-07-28 13:51 ` Jamal Hadi Salim
2017-07-28 14:08 ` Jiri Pirko
2017-07-28 14:19 ` David Ahern
2017-07-28 14:55 ` Jiri Pirko
2017-07-28 15:04 ` Jamal Hadi Salim
2017-07-28 15:13 ` David Ahern
2017-07-28 21:55 ` Jamal Hadi Salim
2017-07-24 1:35 ` [PATCH net-next v11 2/4] net sched actions: Use proper root attribute table for actions Jamal Hadi Salim
2017-07-24 1:35 ` [PATCH net-next v11 3/4] net sched actions: dump more than TCA_ACT_MAX_PRIO actions per batch Jamal Hadi Salim
2017-07-24 11:27 ` Jiri Pirko
2017-07-25 11:22 ` Jamal Hadi Salim
2017-07-25 11:33 ` Jiri Pirko
2017-07-25 12:34 ` Jamal Hadi Salim
2017-07-25 12:37 ` Jiri Pirko
2017-07-28 13:41 ` Jamal Hadi Salim
2017-07-28 14:12 ` Jiri Pirko
2017-07-28 14:52 ` Jamal Hadi Salim
2017-07-28 14:57 ` Jiri Pirko
2017-07-28 15:08 ` Jamal Hadi Salim
2017-07-28 15:45 ` Jiri Pirko [this message]
2017-07-28 22:10 ` Jamal Hadi Salim
2017-07-29 7:19 ` Jiri Pirko
2017-07-29 11:21 ` Jamal Hadi Salim
2017-07-24 1:35 ` [PATCH net-next v11 4/4] net sched actions: add time filter for action dumping Jamal Hadi Salim
2017-07-24 11:34 ` Jiri Pirko
2017-07-25 11:27 ` Jamal Hadi Salim
2017-07-25 11:34 ` Jiri Pirko
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=20170728154547.GG1857@nanopsycho \
--to=jiri@resnulli$(echo .)us \
--cc=alex.aring@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dsahern@gmail$(echo .)com \
--cc=eric.dumazet@gmail$(echo .)com \
--cc=jhs@mojatatu$(echo .)com \
--cc=mrv@mojatatu$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=simon.horman@netronome$(echo .)com \
--cc=xiyou.wangcong@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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