[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170728145718.GF1857@nanopsycho>
Date: Fri, 28 Jul 2017 16:57:18 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
xiyou.wangcong@...il.com, dsahern@...il.com,
eric.dumazet@...il.com, mrv@...atatu.com,
simon.horman@...ronome.com, alex.aring@...il.com
Subject: Re: [PATCH net-next v11 3/4] net sched actions: dump more than
TCA_ACT_MAX_PRIO actions per batch
Fri, Jul 28, 2017 at 04:52:02PM CEST, jhs@...atatu.com wrote:
>On 17-07-28 10:12 AM, Jiri Pirko wrote:
>> Fri, Jul 28, 2017 at 03:41:44PM CEST, jhs@...atatu.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 *.
>
>I am trying to avoid doing unlucky number 13 patch.
I'll rather wait for you to send the code in proper shape so I can
decypher easily and don't have to guess.
>So feedback on this is good. Just look at what it is disallowing
>first.
>
>back later.
>
>cheers,
>jamal
>
>>
>> > I can think of.
>> >
>> > static int validate_nla_bitfield32(const struct nlattr *nla,
>> > void *valid_flags_allowed)
>> > {
>> > const struct nla_bitfield32 *bf = nla_data(nla);
>> > u32 *valid_flags_mask = valid_flags_allowed;
>> >
>> > if (!valid_flags_allowed)
>> > return -EINVAL;
>> > /*disallow invalid selector */
>> > if ((bf->selector & valid_flags_allowed) >*valid_flags_allowed)
>> > 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 & ~nbf->selector)
>> > return -EINVAL;
>> >
>> > return 0;
>> > }
>> >
>> > cheers,
>> > jamal
>
Powered by blists - more mailing lists