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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jLaZqbJw-DXjFD983sW0j_adrGjK5U97h49+9bh28e=w@mail.gmail.com>
Date: Wed, 21 Aug 2024 20:41:54 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Yang Ruibin <11162571@...o.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>, 
	Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>, linux-pm@...r.kernel.org, 
	linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH v1] drivers:thermal:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()

On Wed, Aug 21, 2024 at 9:59 AM Yang Ruibin <11162571@...o.com> wrote:
>
> The debugfs_create_dir() function returns error pointers.
> It never returns NULL. So use IS_ERR() to check it.
>
> Signed-off-by: Yang Ruibin <11162571@...o.com>
> ---
>  drivers/thermal/thermal_debugfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
> index 7dd67bf48571..939d3e5f1817 100644
> --- a/drivers/thermal/thermal_debugfs.c
> +++ b/drivers/thermal/thermal_debugfs.c
> @@ -178,11 +178,11 @@ struct thermal_debugfs {
>  void thermal_debug_init(void)
>  {
>         d_root = debugfs_create_dir("thermal", NULL);
> -       if (!d_root)
> +       if (IS_ERR(d_root))
>                 return;
>
>         d_cdev = debugfs_create_dir("cooling_devices", d_root);
> -       if (!d_cdev)
> +       if (IS_ERR(d_cdev))
>                 return;
>
>         d_tz = debugfs_create_dir("thermal_zones", d_root);
> @@ -202,7 +202,7 @@ static struct thermal_debugfs *thermal_debugfs_add_id(struct dentry *d, int id)
>         snprintf(ids, IDSLENGTH, "%d", id);
>
>         thermal_dbg->d_top = debugfs_create_dir(ids, d);
> -       if (!thermal_dbg->d_top) {
> +       if (IS_ERR(thermal_dbg->d_top)) {
>                 kfree(thermal_dbg);
>                 return NULL;
>         }
> --

Good catch!

Applied as 6.11-rc material with some edits in the subject and changelog.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ