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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB8ipk-su6DRo0DsgaY38Vf2AuxBuvG0GQ0xA22se7Wx5eH0Pg@mail.gmail.com>
Date:   Mon, 29 Aug 2022 14:28:41 +0800
From:   Xuewen Yan <xuewen.yan94@...il.com>
To:     Xuewen Yan <xuewen.yan@...soc.com>
Cc:     viresh.kumar@...aro.org, lukasz.luba@....com,
        amit.kachhap@...il.com, daniel.lezcano@...aro.org,
        rafael@...nel.org, amitk@...nel.org, rui.zhang@...el.com,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        di.shen@...soc.com
Subject: Re: [PATCH] thermal: Check the policy first in cpufreq_cooling_register

Hi all,

Any comments?

On Thu, Aug 25, 2022 at 7:42 PM Xuewen Yan <xuewen.yan@...soc.com> wrote:
>
> Since the policy needs to be accessed first when obtaining cpu devices,
> first check whether the policy is legal before this.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@...soc.com>
> ---
>  drivers/thermal/cpufreq_cooling.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
> index b76293cc989c..7838b6e2dba5 100644
> --- a/drivers/thermal/cpufreq_cooling.c
> +++ b/drivers/thermal/cpufreq_cooling.c
> @@ -501,17 +501,17 @@ __cpufreq_cooling_register(struct device_node *np,
>         struct thermal_cooling_device_ops *cooling_ops;
>         char *name;
>
> +       if (IS_ERR_OR_NULL(policy)) {
> +               pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
> +               return ERR_PTR(-EINVAL);
> +       }
> +
>         dev = get_cpu_device(policy->cpu);
>         if (unlikely(!dev)) {
>                 pr_warn("No cpu device for cpu %d\n", policy->cpu);
>                 return ERR_PTR(-ENODEV);
>         }
>
> -       if (IS_ERR_OR_NULL(policy)) {
> -               pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
> -               return ERR_PTR(-EINVAL);
> -       }
> -
>         i = cpufreq_table_count_valid_entries(policy);
>         if (!i) {
>                 pr_debug("%s: CPUFreq table not found or has no valid entries\n",
> --
> 2.25.1
>

THanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ