Linux ACPI
 help / color / mirror / Atom feed
From: RUC_SoftSec <rucsoftsec@gmail.com>
To: Len Brown <lenb@kernel.org>, "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	RUC_SoftSec <rucsoftsec@gmail.com>
Subject: [PATCH 1/1] acpi: check return value of acpi_os_map_memory
Date: Mon, 28 Oct 2013 14:04:19 +0800	[thread overview]
Message-ID: <1382940259-15183-1-git-send-email-rucsoftsec@gmail.com> (raw)

Function acpi_os_map_memory() may return a NULL pointer, it should be validated non-NULL before used.
This bug is found by a static tool developed by RUC_SoftSec, supported by China.X.Orion.

Signed-off-by: RUC_SoftSec <rucsoftsec@gmail.com>
---
 drivers/acpi/osl.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e5f416c..bf8f93f 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -717,6 +717,8 @@ acpi_os_physical_table_override(struct acpi_table_header *existing_table,
 
 		table = acpi_os_map_memory(acpi_tables_addr + table_offset,
 					   ACPI_HEADER_SIZE);
+		if (table == NULL)
+			return AE_OK;
 
 		if (table_offset + table->length > all_tables_size) {
 			acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-- 
1.7.9.5

             reply	other threads:[~2013-10-28  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28  6:04 RUC_SoftSec [this message]
2013-10-28 11:01 ` [PATCH 1/1] acpi: check return value of acpi_os_map_memory 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=1382940259-15183-1-git-send-email-rucsoftsec@gmail.com \
    --to=rucsoftsec@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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