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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gac0CejDBHmvEh6eeSuQVO1OadYfxT05X6L8Tc=rE1vg@mail.gmail.com>
Date:   Wed, 25 Nov 2020 14:49:13 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Wang ShaoBo <bobo.shaobowang@...wei.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        huawei.libin@...wei.com, cj.chengjian@...wei.com
Subject: Re: [PATCH] cpufreq: Fix error return code in cpufreq_online()

On Wed, Nov 25, 2020 at 1:49 PM Wang ShaoBo <bobo.shaobowang@...wei.com> wrote:
>
> Fix to return proper error code instaed of 0 in cpufreq_online(), as done

s/instaed/instead/

> elsewhere in this function.
>
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@...wei.com>
> ---
>  drivers/cpufreq/cpufreq.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 1e7e3f2ff09f..4645c2b78682 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1391,8 +1391,10 @@ static int cpufreq_online(unsigned int cpu)
>
>                 policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req),
>                                                GFP_KERNEL);
> -               if (!policy->min_freq_req)
> +               if (!policy->min_freq_req) {
> +                       ret = -ENOMEM;
>                         goto out_destroy_policy;
> +               }
>
>                 ret = freq_qos_add_request(&policy->constraints,
>                                            policy->min_freq_req, FREQ_QOS_MIN,
> @@ -1429,6 +1431,7 @@ static int cpufreq_online(unsigned int cpu)
>         if (cpufreq_driver->get && has_target()) {
>                 policy->cur = cpufreq_driver->get(policy->cpu);
>                 if (!policy->cur) {
> +                       ret = -EINVAL;

This error code isn't suitable to be returned from here.  -EIO would be better.

>                         pr_err("%s: ->get() failed\n", __func__);
>                         goto out_destroy_policy;
>                 }
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ