All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Damato <jdamato@fastly.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Donald Hunter <donald.hunter@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Mina Almasry <almasrymina@google.com>,
	Daniel Jurgens <danielj@nvidia.com>,
	Martin Karsten <mkarsten@uwaterloo.ca>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v3 1/2] netdev-genl: Add an XSK attribute to queues
Date: Thu, 6 Feb 2025 17:46:18 -0800	[thread overview]
Message-ID: <Z6Vl6lcPpj1qBN5e@LQ3V64L9R2> (raw)
In-Reply-To: <20250206174138.7de4580d@kernel.org>

On Thu, Feb 06, 2025 at 05:41:38PM -0800, Jakub Kicinski wrote:
> 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;
> }

Yea after reading the code it makes sense that nla_nest_end is not
needed. I wrote a small thing similar to what you proposed above,
but yours is more succinct.

I'll go with that and see how it looks.

> But totally unsure whether it's worthwhile. Just don't want for someone
> to suggest this on v4 and make you respin once again.

No worries; respinning is not the end of the world.

  reply	other threads:[~2025-02-07  1:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 19:10 [PATCH net-next v3 0/2] netdevgenl: Add an xsk attribute to queues Joe Damato
2025-02-04 19:10 ` [PATCH net-next v3 1/2] netdev-genl: Add an XSK " Joe Damato
2025-02-07  0:57   ` Jakub Kicinski
2025-02-07  1:31     ` Joe Damato
2025-02-07  1:41       ` Jakub Kicinski
2025-02-07  1:46         ` Joe Damato [this message]
2025-02-07  6:43   ` kernel test robot
2025-02-04 19:10 ` [PATCH net-next v3 2/2] selftests: drv-net: Test queue xsk attribute Joe Damato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z6Vl6lcPpj1qBN5e@LQ3V64L9R2 \
    --to=jdamato@fastly.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=danielj@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkarsten@uwaterloo.ca \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.