Re: [PATCH] cpufreq: schedutil: Replace sprintf() with sysfs_emit() in sysfs show

From: Rafael J. Wysocki (Intel)

Date: Wed Jul 22 2026 - 09:42:48 EST


On Thu, Jul 16, 2026 at 3:15 PM Zhongqiu Han
<zhongqiu.han@xxxxxxxxxxxxxxxx> wrote:
>
> Use sysfs_emit() instead of sprintf() in rate_limit_us_show().
>
> sysfs_emit() is the preferred API for sysfs output as it provides
> PAGE_SIZE bounds checking and ensures proper sysfs formatting.
>
> No functional change intended.
>
> Signed-off-by: Zhongqiu Han <zhongqiu.han@xxxxxxxxxxxxxxxx>
> ---
> kernel/sched/cpufreq_schedutil.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index dc0835ceee98..96651873345e 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -592,7 +592,7 @@ static ssize_t rate_limit_us_show(struct gov_attr_set *attr_set, char *buf)
> {
> struct sugov_tunables *tunables = to_sugov_tunables(attr_set);
>
> - return sprintf(buf, "%u\n", tunables->rate_limit_us);
> + return sysfs_emit(buf, "%u\n", tunables->rate_limit_us);
> }
>
> static ssize_t
> --

Applied as 7.3 material, thanks!