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: <20241030160756.2099326-2-andriy.shevchenko@linux.intel.com>
Date: Wed, 30 Oct 2024 18:02:17 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Hans de Goede <hdegoede@...hat.com>,
	linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Jonathan Cameron <jic23@...nel.org>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Dan Carpenter <dan.carpenter@...aro.org>
Subject: [PATCH v1 1/4] iio: acpi: Fill data with NULL when iio_get_acpi_device_name_and_data() fails

Fill data with NULL, if provided, when returning NULL from
iio_get_acpi_device_name_and_data(). Note, the current users check
for name to be valid, except one case which was initially doing
like that and has to be fixed separately.

Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/54fac4a7-b601-40ce-8c00-d94807f5e214@stanley.mountain
Fixes: dc60de4eb0a4 ("iio: acpi: Add iio_get_acpi_device_name_and_data() helper function")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 drivers/iio/industrialio-acpi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-acpi.c b/drivers/iio/industrialio-acpi.c
index d67a43843799..33c737c7a2f8 100644
--- a/drivers/iio/industrialio-acpi.c
+++ b/drivers/iio/industrialio-acpi.c
@@ -102,13 +102,17 @@ EXPORT_SYMBOL_GPL(iio_read_acpi_mount_matrix);
  * NOTE: This helper function exists only for backward compatibility,
  * do not use in a new code!
  *
- * Returns: ACPI device instance name or %NULL.
+ * Returns: ACPI device instance name or %NULL When returning %NULL, the @data,
+ * if provided, will be also initialised to %NULL.
  */
 const char *iio_get_acpi_device_name_and_data(struct device *dev, const void **data)
 {
 	const struct acpi_device_id *id;
 	acpi_handle handle;
 
+	if (data)
+		*data = NULL;
+
 	handle = ACPI_HANDLE(dev);
 	if (!handle)
 		return NULL;
-- 
2.43.0.rc1.1336.g36b5255a03ac


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ