mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH] thermal: core: Replace sprintf in thermal_bind_cdev_to_trip
Date: Fri, 6 Mar 2026 14:05:25 +0000	[thread overview]
Message-ID: <b9981ace-4af9-4b42-a474-65239b372297@arm.com> (raw)
In-Reply-To: <20260223073245.321298-2-thorsten.blum@linux.dev>



On 2/23/26 07:32, Thorsten Blum wrote:
> Replace unbounded sprintf() with the safer snprintf(). While the
> current code works correctly, snprintf() is safer and follows secure
> coding best practices.  No functional changes.

Agree

> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   drivers/thermal/thermal_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 17ca5c082643..89dd1666805f 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -861,7 +861,7 @@ static int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz,
>   		goto free_mem;
>   
>   	dev->id = result;
> -	sprintf(dev->name, "cdev%d", dev->id);
> +	snprintf(dev->name, sizeof(dev->name), "cdev%d", dev->id);
>   	result =
>   	    sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name);
>   	if (result)


LGTM, please add the tag and re-send so it's on top
so faster to pick-up for merging

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

  reply	other threads:[~2026-03-06 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23  7:32 Thorsten Blum
2026-03-06 14:05 ` Lukasz Luba [this message]
2026-03-06 17:49   ` Rafael J. Wysocki

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=b9981ace-4af9-4b42-a474-65239b372297@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thorsten.blum@linux.dev \
    /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®