Re: [PATCH net-next v3 1/2] netdev-genl: Add an XSK attribute to queues
From: Jakub Kicinski
Date: Thu Feb 06 2025 - 20:42:59 EST
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.