All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to 3.12-stable] ACPI / sysfs: fix error code in get_status()
Date: Thu, 22 Sep 2016 09:11:46 +0200	[thread overview]
Message-ID: <20160922071154.1297-34-jslaby@suse.cz> (raw)
In-Reply-To: <20160922071154.1297-1-jslaby@suse.cz>

From: Dan Carpenter <dan.carpenter@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit f18ebc211e259d4f591e39e74b2aa2de226c9a1d upstream.

The problem with ornamental, do-nothing gotos is that they lead to
"forgot to set the error code" bugs.  We should be returning -EINVAL
here but we don't.  It leads to an uninitalized variable in
counter_show():

    drivers/acpi/sysfs.c:603 counter_show()
    error: uninitialized symbol 'status'.

Fixes: 1c8fce27e275 (ACPI: introduce drivers/acpi/sysfs.c)
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/sysfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 05306a59aedc..f072461c5869 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -492,23 +492,22 @@ static void acpi_global_event_handler(u32 event_type, acpi_handle device,
 static int get_status(u32 index, acpi_event_status *status,
 		      acpi_handle *handle)
 {
-	int result = 0;
+	int result;
 
 	if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
-		goto end;
+		return -EINVAL;
 
 	if (index < num_gpes) {
 		result = acpi_get_gpe_device(index, handle);
 		if (result) {
 			ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
 					"Invalid GPE 0x%x", index));
-			goto end;
+			return result;
 		}
 		result = acpi_get_gpe_status(*handle, index, status);
 	} else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS))
 		result = acpi_get_event_status(index - num_gpes, status);
 
-end:
 	return result;
 }
 
-- 
2.10.0


  parent reply	other threads:[~2016-09-22  7:12 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22  7:11 [patch added to 3.12-stable] MIPS: KVM: Check for pfn noslot case Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] x86/mm: Disable preemption during CR3 read+write Jiri Slaby
2016-09-22  7:11   ` Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] arm64: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO Jiri Slaby
2016-09-22  7:11   ` Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] parisc: Fix order of EREFUSED define in errno.h Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] PCI: Support PCIe devices with short cfg_size Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] PCI: Add Netronome vendor and device IDs Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] PCI: Limit config space size for Netronome NFP6000 family Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] PCI: Add Netronome NFP4000 PF device ID Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] PCI: Limit config space size for Netronome NFP4000 Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] usb: dwc3: gadget: increment request->actual once Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] usb: define USB_SPEED_SUPER_PLUS speed for SuperSpeedPlus USB3.1 devices Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: validate wMaxPacketValue entries in endpoint descriptors Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] usb: xhci: Fix panic if disconnect Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: fix memleak in driver-registration error path Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: option: add D-Link DWM-156/A3 Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: option: add support for Telit LE920A4 Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: ftdi_sio: add device ID for WICED USB UART dev board Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: ftdi_sio: add PIDs for Ivium Technologies devices Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] xhci: Make sure xhci handles USB_SPEED_SUPER_PLUS devices Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] EDAC: Increment correct counter in edac_inc_ue_error() Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] s390/dasd: fix hanging device after clear subchannel Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] mac80211: fix purging multicast PS buffer queue Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] aacraid: Check size values after double-fetch from user Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] cdc-acm: fix wrong pipe type on rx interrupt xfers Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] megaraid_sas: Fix probing cards without io port Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] gpio: Fix OF build problem on UM Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] fs/seq_file: fix out-of-bounds read Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] Input: i8042 - break load dependency between atkbd/psmouse and i8042 Jiri Slaby
2016-09-22 16:37   ` Dmitry Torokhov
2016-09-23  8:23     ` Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] crypto: nx - off by one bug in nx_of_update_msc() Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: fix typo in wMaxPacketSize validation Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: mos7720: fix non-atomic allocation in write path Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] USB: serial: mos7840: " Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] staging: comedi: daqboard2000: bug fix board type matching code Jiri Slaby
2016-09-22  7:11 ` Jiri Slaby [this message]
2016-09-22  7:11 ` [patch added to 3.12-stable] Revert "can: fix handling of unmodifiable configuration options fix" Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] be2iscsi: Fix bogus WARN_ON length check Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] HID: hid-input: Add parentheses to quell gcc warning Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] ALSA: oxygen: Fix logical-not-parentheses warning Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] stb6100: fix buffer length check in stb6100_write_reg_range() Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] ext4: validate that metadata blocks do not overlap superblock Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] s390/sclp_ctl: fix potential information leak with /dev/sclp Jiri Slaby
2016-09-22  7:11 ` [patch added to 3.12-stable] fix d_walk()/non-delayed __d_free() race Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160922071154.1297-34-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=dan.carpenter@oracle.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.