[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxpeL7S2GZeJOiQw@hog>
Date: Thu, 24 Oct 2024 16:48:15 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Johannes Berg <johannes@...solutions.net>
Cc: linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [RFC PATCH 2/2] net: convert to nla_get_*_default()
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
Powered by blists - more mailing lists