Re: [PATCH 4/7] netlink: extend policy range validation

2020-04-29 Thread Johannes Berg
On Wed, 2020-04-29 at 11:10 -0700, Jakub Kicinski wrote: > > +static int nla_validate_int_range_unsigned(const struct nla_policy *pt, > > + const struct nlattr *nla, > > + struct netlink_ext_ack *extack) > > { > > - bool

Re: [PATCH 4/7] netlink: extend policy range validation

2020-04-29 Thread Jakub Kicinski
On Wed, 29 Apr 2020 15:48:40 +0200 Johannes Berg wrote: > diff --git a/lib/nlattr.c b/lib/nlattr.c > index 7f7ebd89caa4..bb66d06cc6f9 100644 > --- a/lib/nlattr.c > +++ b/lib/nlattr.c > @@ -111,17 +111,33 @@ static int nla_validate_array(const struct nlattr > *head, int len, int maxtype, > re

[PATCH 4/7] netlink: extend policy range validation

2020-04-29 Thread Johannes Berg
From: Johannes Berg Using a pointer to a struct indicating the min/max values, extend the ability to do range validation for arbitrary values. Small values in the s16 range can be kept in the policy directly. Signed-off-by: Johannes Berg --- include/net/netlink.h | 45 + lib/n