Skip to contentSkip to conversation

Patch "ACPI / power: Avoid maybe-uninitialized warning" has been added to the 3.18-stable tree

PATCH [email protected] 1 participant 1 message Apr 24, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ACPI / power: Avoid maybe-uninitialized warning

to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
acpi-power-avoid-maybe-uninitialized-warning.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From fe8c470ab87d90e4b5115902dd94eced7e3305c3 Mon Sep 17 00:00:00 2001

From: Arnd Bergmann <[email protected]>
Date: Wed, 19 Apr 2017 19:47:04 +0200
Subject: ACPI / power: Avoid maybe-uninitialized warning

From: Arnd Bergmann <[email protected]>

commit fe8c470ab87d90e4b5115902dd94eced7e3305c3 upstream.

gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state() is enterered at least once, so it assumes that cur_state might not get initialized:

drivers/acpi/power.c: In function 'acpi_power_get_inferred_state':
drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets the variable to zero at the start of the loop, to ensure that there is well-defined behavior even for an empty list. This gets rid of the warning.

The warning first showed up when the -Os flag got removed in a bug fix patch in linux-4.11-rc5.

I would suggest merging this addon patch on top of that bug fix to avoid introducing a new warning in the stable kernels.

Fixes 61b79e16c68d (ACPI: Fix incompatibility with mcount-based function graph tracing)
---
 drivers/acpi/power.c |    1 +
 1 file changed, 1 insertion(+)
drivers/acpi/power.c +1 -0
@@ -201,6 +201,7 @@ static int acpi_power_get_list_state(str
 		return -EINVAL;
 
 	/* The state of the list is 'on' IFF all resources are 'on'. */
+	cur_state = 0;
 	list_for_each_entry(entry, list, node) {
 		struct acpi_power_resource *resource = entry->resource;
 		acpi_handle handle = resource->device.handle;

Patches currently in stable-queue which might be from [email protected] are

queue-3.18/acpi-power-avoid-maybe-uninitialized-warning.patch