mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Damato <joe@dama.to>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wen Gu <guwen@linux.alibaba.com>,
	Philo Lu <lulie@linux.alibaba.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v2 1/5] eea: Drop temporary buffer by using %*pEhp directly
Date: Fri, 2 Oct 2026 13:50:31 -0700	[thread overview]
Message-ID: <asAZF53tsdq/QAYv@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <20261002100035.863275-2-andriy.shevchenko@linux.intel.com>

On Fri, Oct 02, 2026 at 11:59:19AM +0200, Andy Shevchenko wrote:
> Instead of calling string_escape_str() followed by %s specifier,
> use %*pEhp specifier directly. With this being done, drop temporary
> buffer.
> 
> Note, as Sashiko pointed out in [1] the %*pEp, which is the direct
> substitution of the original call to string_escape_str() with ESCAPE_NP
> flag set, makes the whole thing like "no escape". To add some sanity
> to this the used specifier also includes ESCAPE_HEX.
> 
> Link: https://lore.kernel.org/r/179089728102.434549.12368098081790653201@kernel.org [1]
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/net/ethernet/alibaba/eea/eea_adminq.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/alibaba/eea/eea_adminq.c b/drivers/net/ethernet/alibaba/eea/eea_adminq.c
> index 73d0caf25700..f2284fc885c3 100644
> --- a/drivers/net/ethernet/alibaba/eea/eea_adminq.c
> +++ b/drivers/net/ethernet/alibaba/eea/eea_adminq.c
> @@ -522,16 +522,9 @@ void eea_adminq_config_host_info(struct eea_net *enet)
>  			dev_warn(dev, "The hardware-driven state validation may be abnormal.\n");
>  
>  		if (rep->has_reply) {
> -			char buf[EEA_HINFO_MAX_REP_LEN] = {0};
> -
>  			rep->reply_str[EEA_HINFO_MAX_REP_LEN - 1] = '\0';
> -
> -			string_escape_str(rep->reply_str, buf, sizeof(buf),
> -					  ESCAPE_NP, NULL);
> -
> -			buf[EEA_HINFO_MAX_REP_LEN - 1] = '\0';
> -
> -			dev_warn(dev, "Device replied: %s\n", buf);
> +			dev_warn(dev, "Device replied: %*pEhp\n",
> +				 (int)strlen(rep->reply_str), rep->reply_str);

i have no idea what this otuput could be but i suppose if you wanted to remove
the terminator write above, you could do:

   strnlen(rep->reply_str, ....)

instead, but that feels like a fairly useless nit so:

Reviewed-by: Joe Damato <joe@dama.to>

  reply	other threads:[~2026-10-02 20:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  9:59 [PATCH net-next v2 0/5] eea: Improvements in the driver Andy Shevchenko
2026-10-02  9:59 ` [PATCH net-next v2 1/5] eea: Drop temporary buffer by using %*pEhp directly Andy Shevchenko
2026-10-02 20:50   ` Joe Damato [this message]
2026-10-02  9:59 ` [PATCH net-next v2 2/5] eea: Remove unneeded assignment Andy Shevchenko
2026-10-02 20:33   ` Joe Damato
2026-10-02  9:59 ` [PATCH net-next v2 3/5] eea: Refactor error handling in eea_adminq_config_host_info() Andy Shevchenko
2026-10-02 20:37   ` Joe Damato
2026-10-02  9:59 ` [PATCH net-next v2 4/5] eea: unify return code variable name Andy Shevchenko
2026-10-02 20:40   ` Joe Damato
2026-10-02  9:59 ` [PATCH net-next v2 5/5] eea: Use 2-argument strscpy() Andy Shevchenko
2026-10-02 20:42   ` 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=asAZF53tsdq/QAYv@devvm20253.cco0.facebook.com \
    --to=joe@dama.to \
    --cc=andrew+netdev@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=guwen@linux.alibaba.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulie@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®