[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206174138.7de4580d@kernel.org>
Date: Thu, 6 Feb 2025 17:41:38 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Joe Damato <jdamato@...tly.com>
Cc: netdev@...r.kernel.org, Donald Hunter <donald.hunter@...il.com>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Andrew Lunn
<andrew+netdev@...n.ch>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Stanislav
Fomichev <sdf@...ichev.me>, Mina Almasry <almasrymina@...gle.com>, Daniel
Jurgens <danielj@...dia.com>, Martin Karsten <mkarsten@...terloo.ca>, open
list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v3 1/2] netdev-genl: Add an XSK attribute to
queues
On Thu, 6 Feb 2025 17:31:47 -0800 Joe Damato wrote:
> > nla_nest_start() can fail, you gotta nul-check the return value.
> > You could possibly add an nla_put_empty_nest() helper in netlink.h
> > to make this less awkward? I think the iouring guys had the same bug
>
> Ah, right.
>
> I'll see what a helper looks like. Feels like maybe overkill?
Yeah, not sure either. Technically nla_nest_end() isn't required here,
but that's not very obvious to a casual reader. So a helper that hides
that fact could be useful:
static inline int nla_put_empty_nest(struct sk_buff *skb, int attrtype)
{
return nla_nest_start(skb, attrtype) ? 0 : -EMSGSIZE;
}
But totally unsure whether it's worthwhile. Just don't want for someone
to suggest this on v4 and make you respin once again.
Powered by blists - more mailing lists