Search Linux Wireless

Re: [PATCH] netlink: add policy attribute range validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux