public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Jiri Pirko <jiri@nvidia.com>,
	David Ahern <dsahern@kernel.org>,
	netdev@vger.kernel.org, Florian Westphal <fw@strlen.de>,
	eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 6/6] inet: use xa_array iterator to implement inet_dump_ifaddr()
Date: Thu, 29 Feb 2024 07:37:50 -0800	[thread overview]
Message-ID: <20240229073750.6e59155e@kernel.org> (raw)
In-Reply-To: <20240229114016.2995906-7-edumazet@google.com>

On Thu, 29 Feb 2024 11:40:16 +0000 Eric Dumazet wrote:
> +	if (err < 0 && likely(skb->len))
> +		err = skb->len;

I think Ido may have commented on one of your early series, but if we
set err to skb->len we'll have to do an extra empty message to terminate
the dump.

You basically only want to return skb->len when message has
overflown, so the somewhat idiomatic way to do this is:

	err = (err == -EMSGSIZE) ? skb->len : err;

Assuming err can't be set to some weird positive value.

IDK if you want to do this in future patches or it's risky, but I have
the itch to tell you every time I see a conversion which doesn't follow
this pattern :)

  reply	other threads:[~2024-02-29 15:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 11:40 [PATCH net-next 0/6] inet: no longer use RTNL to protect inet_dump_ifaddr() Eric Dumazet
2024-02-29 11:40 ` [PATCH net-next 1/6] inet: annotate data-races around ifa->ifa_tstamp and ifa->ifa_cstamp Eric Dumazet
2024-02-29 11:40 ` [PATCH net-next 2/6] inet: annotate data-races around ifa->ifa_valid_lft Eric Dumazet
2024-02-29 11:40 ` [PATCH net-next 3/6] inet: annotate data-races around ifa->ifa_preferred_lft Eric Dumazet
2024-02-29 11:40 ` [PATCH net-next 4/6] inet: annotate data-races around ifa->ifa_flags Eric Dumazet
2024-02-29 11:40 ` [PATCH net-next 5/6] inet: prepare inet_base_seq() to run without RTNL Eric Dumazet
2024-02-29 11:40 ` [PATCH net-next 6/6] inet: use xa_array iterator to implement inet_dump_ifaddr() Eric Dumazet
2024-02-29 15:37   ` Jakub Kicinski [this message]
2024-02-29 15:45     ` Eric Dumazet
2024-02-29 15:50       ` Eric Dumazet
2024-02-29 16:21         ` Jakub Kicinski
2024-02-29 16:26           ` Eric Dumazet
2024-02-29 14:18 ` [PATCH net-next 0/6] inet: no longer use RTNL to protect inet_dump_ifaddr() Jiri Pirko
2024-03-01 11:20 ` patchwork-bot+netdevbpf

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=20240229073750.6e59155e@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=jiri@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox