Search Linux Wireless

Re: [RFC PATCH 2/2] net: convert to nla_get_*_default()

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

 



2024-10-24, 15:41:59 +0200, Johannes Berg wrote:
> 
> Also just realized that some of the conversions are wrong, e.g.
> 
> > @@ -7378,17 +7375,11 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
> >  	if (info->attrs[NL80211_ATTR_VLAN_ID])
> >  		params.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]);
> >  
> > -	if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL])
> > -		params.listen_interval =
> > -		     nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]);
> > -	else
> > -		params.listen_interval = -1;
> > +	params.listen_interval = nla_get_u16_default(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL],
> > +						     -1);
> 
> 
> this one clearly is.

Ouch, and really easy to miss while reviewing.

If nla_get_*_default was a macro (generating an "attr ? getter :
default" expression) you wouldn't have that problem I think, but you
couldn't nicely generate all the helpers with MAKE_NLA_GET_DEFAULT
anymore.

-- 
Sabrina




[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