lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGTfZH1T+hvErU6sU-bMOiDfSSTTbt-ygOvEC42B4EaEYvy_tw@mail.gmail.com>
Date: Wed, 14 May 2025 02:19:23 +0900
From: Chanwoo Choi <chanwoo@...nel.org>
To: Lifeng Zheng <zhenglifeng1@...wei.com>
Cc: myungjoo.ham@...sung.com, kyungmin.park@...sung.com, cw00.choi@...sung.com, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, linuxarm@...wei.com, 
	jonathan.cameron@...wei.com, zhanjie9@...ilicon.com, lihuisong@...wei.com, 
	yubowen8@...wei.com, cenxinghai@...artners.com
Subject: Re: [PATCH 1/4] PM / devfreq: governor: Replace sscanf() with
 kstrtoul() in set_freq_store()

Hi,

Applied it. Thanks.

On Mon, Apr 21, 2025 at 12:00 PM Lifeng Zheng <zhenglifeng1@...wei.com> wrote:
>
> Replace sscanf() with kstrtoul() in set_freq_store() and check the result
> to avoid invalid input.
>
> Signed-off-by: Lifeng Zheng <zhenglifeng1@...wei.com>
> ---
>  drivers/devfreq/governor_userspace.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c
> index d1aa6806b683..175de0c0b50e 100644
> --- a/drivers/devfreq/governor_userspace.c
> +++ b/drivers/devfreq/governor_userspace.c
> @@ -9,6 +9,7 @@
>  #include <linux/slab.h>
>  #include <linux/device.h>
>  #include <linux/devfreq.h>
> +#include <linux/kstrtox.h>
>  #include <linux/pm.h>
>  #include <linux/mutex.h>
>  #include <linux/module.h>
> @@ -39,10 +40,13 @@ static ssize_t set_freq_store(struct device *dev, struct device_attribute *attr,
>         unsigned long wanted;
>         int err = 0;
>
> +       err = kstrtoul(buf, 0, &wanted);
> +       if (err)
> +               return err;
> +
>         mutex_lock(&devfreq->lock);
>         data = devfreq->governor_data;
>
> -       sscanf(buf, "%lu", &wanted);
>         data->user_frequency = wanted;
>         data->valid = true;
>         err = update_devfreq(devfreq);
> --
> 2.33.0
>
>


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ