linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Kaneda <erik.kaneda@intel.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>, linux-acpi@vger.kernel.org
Cc: Erik Kaneda <erik.kaneda@intel.com>,
	Kurt Kennett <kurt_kennett@hotmail.com>,
	Bob Moore <robert.moore@intel.com>
Subject: [PATCH 4/6] ACPICA: Dispatcher: add status checks
Date: Mon,  4 May 2020 17:46:52 -0700	[thread overview]
Message-ID: <20200505004654.2870591-5-erik.kaneda@intel.com> (raw)
In-Reply-To: <20200505004654.2870591-1-erik.kaneda@intel.com>

The status chekcs are used to to avoid NULL pointer dereference on
field objects

ACPICA commit 3244c1eeba9f9fb9ccedb875f7923a3d85e0c6aa

Link: https://github.com/acpica/acpica/commit/3244c1ee
Reported-by: Kurt Kennett <kurt_kennett@hotmail.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
---
 drivers/acpi/acpica/dsfield.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 0189b5d4e3a3..fa768b3a989e 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -517,13 +517,20 @@ acpi_ds_create_field(union acpi_parse_object *op,
 	info.region_node = region_node;
 
 	status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
 	if (info.region_node->object->region.space_id ==
-	    ACPI_ADR_SPACE_PLATFORM_COMM
-	    && !(region_node->object->field.internal_pcc_buffer =
-		 ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
-				      length))) {
-		return_ACPI_STATUS(AE_NO_MEMORY);
+	    ACPI_ADR_SPACE_PLATFORM_COMM) {
+		region_node->object->field.internal_pcc_buffer =
+		    ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
+					 length);
+		if (!region_node->object->field.internal_pcc_buffer) {
+			return_ACPI_STATUS(AE_NO_MEMORY);
+		}
 	}
+
 	return_ACPI_STATUS(status);
 }
 
-- 
2.25.1


  parent reply	other threads:[~2020-05-05  1:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05  0:46 [PATCH 0/6] ACPICA release 20200430 Erik Kaneda
2020-05-05  0:46 ` [PATCH 1/6] ACPICA: Make acpi_protocol_lengths static Erik Kaneda
2020-05-05  0:46 ` [PATCH 2/6] ACPICA: Move acpi_gbl_next_cmd_num definition to acglobal.h Erik Kaneda
2020-05-05  0:46 ` [PATCH 3/6] ACPICA: Disassembler: ignore AE_ALREADY_EXISTS status when parsing create operators Erik Kaneda
2020-05-05  0:46 ` Erik Kaneda [this message]
2020-05-05  0:46 ` [PATCH 5/6] ACPICA: Fix required parameters for _NIG and _NIH Erik Kaneda
2020-05-05  0:46 ` [PATCH 6/6] ACPICA: Update version to 20200430 Erik Kaneda
2020-05-09  9:16 ` [PATCH 0/6] ACPICA release 20200430 Rafael J. Wysocki

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=20200505004654.2870591-5-erik.kaneda@intel.com \
    --to=erik.kaneda@intel.com \
    --cc=kurt_kennett@hotmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).