public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	bridge@lists.linux-foundation.org,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, Nikolay Aleksandrov <razor@blackwall.org>,
	Paolo Abeni <pabeni@redhat.com>, Roopa Prabhu <roopa@nvidia.com>
Subject: Re: [PATCH net-next] netlink: provide an ability to set default extack message
Date: Fri, 27 Jan 2023 11:22:42 +0200	[thread overview]
Message-ID: <20230127092242.ajwlo3tivxsjsul7@skbuf> (raw)
In-Reply-To: <Y9NfkgRbWAbrxQ1G@unreal>

On Fri, Jan 27, 2023 at 07:22:26AM +0200, Leon Romanovsky wrote:
> It means changing ALL error unwind places where extack was forwarded
> before to subfunctions.
> 
> Places like this:
>  ret = func(..., extack)
>  if (ret) {
>    NL_SET_ERR_MSG_MOD...
>    return ret;
>  }
> 
> will need to be changed to something like this:
>  ret = func(..., extack)
>  if (ret) {
>    NL_SET_ERR_MSG_WEAK...
>    return ret;
>  }

Yeah, but my point is that you inspect the code that you plan to convert,
rather than converting it in bulk and inspecting later...

> Can we please discuss current code and not over-engineered case which
> doesn't exist in the reality?
> 
> Even for your case, I would like to see NL_SET_ERR_MSG_FORCE() to
> explicitly say that message will be overwritten.

__nla_validate_parse()

	if (unlikely(rem > 0)) {
		pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
				    rem, current->comm);
		NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes");
		if (validate & NL_VALIDATE_TRAILING)
			return -EINVAL;
	}

	return 0;

called by nla_validate_deprecated() with validate == NL_VALIDATE_LIBERAL

followed by other extack setting in tunnel_key_copy_opts(), which will
not overwrite the initial warning message.

      reply	other threads:[~2023-01-27  9:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 19:15 [PATCH net-next] netlink: provide an ability to set default extack message Leon Romanovsky
2023-01-26 22:32 ` Vladimir Oltean
2023-01-26 22:37   ` Jakub Kicinski
2023-01-26 22:44     ` Vladimir Oltean
2023-01-26 23:39       ` Jakub Kicinski
2023-01-27  5:26     ` Leon Romanovsky
2023-01-27  7:26       ` Jakub Kicinski
2023-01-29 11:43         ` Leon Romanovsky
2023-01-27  5:22   ` Leon Romanovsky
2023-01-27  9:22     ` Vladimir Oltean [this message]

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=20230127092242.ajwlo3tivxsjsul7@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.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