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: <20221110141302.GB2404288@roeck-us.net>
Date:   Thu, 10 Nov 2022 06:13:02 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Daniel Lezcano <daniel.lezcano@...aro.org>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/9] thermal/core: Ensure that thermal device is
 registered in thermal_zone_get_temp

On Wed, Nov 09, 2022 at 08:07:48PM +0100, Rafael J. Wysocki wrote:
[ ... ]
> >
> > diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
> > index c65cdce8f856..3bac0b7a4c62 100644
> > --- a/drivers/thermal/thermal_helpers.c
> > +++ b/drivers/thermal/thermal_helpers.c
> > @@ -115,7 +115,12 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
> >         int ret;
> >
> >         mutex_lock(&tz->lock);
> > +       if (!device_is_registered(&tz->device)) {
> > +               ret = -ENODEV;
> > +               goto unlock;
> > +       }
> >         ret = __thermal_zone_get_temp(tz, temp);
> > +unlock:
> 
> I would do it this way:
> 
> if (device_is_registered(&tz->device))
>         ret = __thermal_zone_get_temp(tz, temp);
> else
>         ret = -ENODEV;
> 
Done in all patches. Agreed, that looks much better.

Thanks,
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ