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: <20200428215804.48481-1-arnd@arndb.de>
Date:   Tue, 28 Apr 2020 23:55:57 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rob Herring <robh@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] acpi: avoid uninialized-variable warning

Older compilers like gcc-4.8 produce a bogus warning here

In file included from include/linux/compiler_types.h:68:0,
                 from <command-line>:0:
drivers/acpi/property.c: In function 'acpi_data_prop_read':
include/linux/compiler-gcc.h:75:45: error: 'obj' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
                                             ^
drivers/acpi/property.c:934:27: note: 'obj' was declared here
  const union acpi_object *obj;
                           ^

Ensure the output is always initialized even when returning an error
to avoid the warning.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/acpi/property.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index e601c4511a8b..3aa71daeb0b4 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -587,8 +587,10 @@ static int acpi_data_get_property_array(const struct acpi_device_data *data,
 	int ret, i;
 
 	ret = acpi_data_get_property(data, name, ACPI_TYPE_PACKAGE, &prop);
-	if (ret)
+	if (ret && obj) {
+		*obj = NULL;
 		return ret;
+	}
 
 	if (type != ACPI_TYPE_ANY) {
 		/* Check that all elements are of correct type. */
-- 
2.26.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ