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: <63b16433-9f80-492f-9389-633a9852a223@weissschuh.net>
Date: Wed, 30 Oct 2024 10:42:18 -0600 (CST)
From: Thomas Weißschuh <thomas@...ssschuh.net>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Thomas Weißschuh <linux@...ssschuh.net>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>
Subject: Re: [PATCH v1 1/1] ACPI: battery: Check for error code from
 devm_mutex_init() call

Hi Andy,

Oct 30, 2024 10:28:03 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>:

> Even if it's not critical, the avoidance of checking the error code
> from devm_mutex_init() call today diminishes the point of using devm
> variant of it. Tomorrow it may even leak something. Add the missed
> check.

Thanks!

Assuming you found this via some sort of tool and you already fixed up all the other places in the tree missing these checks,
wouldn't it make sense to mark devm_mutex_init() as __must_check?

> Fixes: 0710c1ce5045 ("ACPI: battery: initialize mutexes through devm_ APIs")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Reviewed-by: Thomas Weißschuh <linux@...ssschuh.net>

> ---
> drivers/acpi/battery.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 66662712e288..70f706d7634f 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -1226,8 +1226,12 @@ static int acpi_battery_add(struct acpi_device *device)
>     strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
>     strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
>     device->driver_data = battery;
> -   devm_mutex_init(&device->dev, &battery->lock);
> -   devm_mutex_init(&device->dev, &battery->sysfs_lock);
> +   result = devm_mutex_init(&device->dev, &battery->lock);
> +   if (result)
> +       return result;
> +   result = devm_mutex_init(&device->dev, &battery->sysfs_lock);
> +   if (result)
> +       return result;
>     if (acpi_has_method(battery->device->handle, "_BIX"))
>         set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
>
> --
> 2.43.0.rc1.1336.g36b5255a03ac


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ