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-next>] [day] [month] [year] [list]
Message-Id: <1418923002-901-1-git-send-email-daniel.baluta@intel.com>
Date:	Thu, 18 Dec 2014 19:16:42 +0200
From:	Daniel Baluta <daniel.baluta@...el.com>
To:	jic23@...nel.org
Cc:	knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
	gwendal@...omium.org, srinivas.pandruvada@...ux.intel.com,
	beomho.seo@...sung.com, daniel.baluta@...el.com,
	linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
	octavian.purdila@...el.com
Subject: [RFC PATCH] iio: ak8975: Make sure chipset is always initialized

When using ACPI, if acpi_match_device fails then chipset enum will be
uninitialized and &ak_def_array[chipset] will point to some bad address.

This fixes the following compilation warning:

drivers/iio/magnetometer/ak8975.c: In function ‘ak8975_probe’:
drivers/iio/magnetometer/ak8975.c:788:14: warning: ‘chipset’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  data->def = &ak_def_array[chipset];

Reported-by: Octavian Purdila <octavian.purdila@...el.com>
Signed-off-by: Daniel Baluta <daniel.baluta@...el.com>
---
This is a RFC because while I'm pretty sure that chipset should be initialized
with AK_MAX_TYPE in ak8975_match_acpi_device, I am not sure if we can live with
a NULL return value of ak8975_match_acpi_device. Current implementation ignores
return value of ak8975_match_acpi_device.

The same situation is for kxcjk-1013, bmc150-accel, bmg160 and possible other
drivers.

 drivers/iio/magnetometer/ak8975.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index 0d10a4b..cdf9e77 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -716,6 +716,7 @@ static const char *ak8975_match_acpi_device(struct device *dev,
 {
 	const struct acpi_device_id *id;
 
+	*chipset = AK_MAX_TYPE;
 	id = acpi_match_device(dev->driver->acpi_match_table, dev);
 	if (!id)
 		return NULL;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ