mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Dmitry Antipov <dmantipov@yandex.ru>,
	Borislav Petkov <bp@alien8.de>, <x86@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>,
	Dave Martin <Dave.Martin@arm.com>,
	"James Morse" <james.morse@arm.com>,
	Babu Moger <babu.moger@amd.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] fs/resctrl: Avoid extra call to strlen() in schemata_list_add()
Date: Thu, 3 Sep 2026 08:42:47 -0700	[thread overview]
Message-ID: <f7a73d18-25a4-4711-9d18-8b87eb9af7d3@intel.com> (raw)
In-Reply-To: <20260821081128.19242-1-dmantipov@yandex.ru>

Dear x86 maintainers,

Could you please consider both cleanups in this series for inclusion?

Thank you very much.

Reinette

On 8/21/26 1:11 AM, Dmitry Antipov wrote:
> After passing an overflow check, it's safe to assume that snprintf()
> returns the number of characters emitted. So drop the unnecessary
> call to strlen().
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> v2: adjust title and commit message (Reinette)
> ---
>  fs/resctrl/rdtgroup.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index 5dcbb0a964e8..68be9b903ac6 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -2858,7 +2858,7 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type
>  {
>  	struct resctrl_schema *s;
>  	const char *suffix = "";
> -	int ret, cl;
> +	int cl;
>  
>  	s = kzalloc_obj(*s);
>  	if (!s)
> @@ -2882,14 +2882,12 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type
>  		break;
>  	}
>  
> -	ret = snprintf(s->name, sizeof(s->name), "%s%s", r->name, suffix);
> -	if (ret >= sizeof(s->name)) {
> +	cl = snprintf(s->name, sizeof(s->name), "%s%s", r->name, suffix);
> +	if (cl >= sizeof(s->name)) {
>  		kfree(s);
>  		return -EINVAL;
>  	}
>  
> -	cl = strlen(s->name);
> -
>  	/*
>  	 * If CDP is supported by this resource, but not enabled,
>  	 * include the suffix. This ensures the tabular format of the


  parent reply	other threads:[~2026-09-03 15:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  8:11 Dmitry Antipov
2026-08-21  8:11 ` [PATCH v2 2/2] fs/resctrl: Simplify pseudo_lock_measure_trigger() Dmitry Antipov
2026-08-25 18:25   ` Reinette Chatre
2026-09-17 21:26   ` [tip: x86/cache] " tip-bot2 for Dmitry Antipov
2026-08-25 18:25 ` [PATCH v2 1/2] fs/resctrl: Avoid extra call to strlen() in schemata_list_add() Reinette Chatre
2026-09-03 15:42 ` Reinette Chatre [this message]
2026-09-17 15:54   ` Borislav Petkov
2026-09-17 16:17     ` Reinette Chatre
2026-09-17 17:37       ` Borislav Petkov
2026-09-17 21:26 ` [tip: x86/cache] " tip-bot2 for Dmitry Antipov

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=f7a73d18-25a4-4711-9d18-8b87eb9af7d3@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dmantipov@yandex.ru \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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®