Thread (34 messages) 34 messages, 3 authors, 2017-07-29

Re: [PATCH net-next v11 3/4] net sched actions: dump more than TCA_ACT_MAX_PRIO actions per batch

From: Jiri Pirko <jiri@resnulli.us>
Date: 2017-07-28 15:45:51

Fri, Jul 28, 2017 at 05:08:10PM CEST, jhs@mojatatu.com wrote:
On 17-07-28 10:52 AM, Jamal Hadi Salim wrote:
quoted
On 17-07-28 10:12 AM, Jiri Pirko wrote:
quoted
Fri, Jul 28, 2017 at 03:41:44PM CEST, jhs@mojatatu.com wrote:
[..]
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help