From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH 1/1] acpi: check return value of acpi_os_map_memory Date: Mon, 28 Oct 2013 12:01:46 +0100 Message-ID: <3198340.cKCt9ZmSgp@vostro.rjw.lan> References: <1382940259-15183-1-git-send-email-rucsoftsec@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7Bit Return-path: Received: from v094114.home.net.pl ([79.96.170.134]:56362 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754133Ab3J1Ktk (ORCPT ); Mon, 28 Oct 2013 06:49:40 -0400 In-Reply-To: <1382940259-15183-1-git-send-email-rucsoftsec@gmail.com> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: RUC_SoftSec Cc: Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org On Monday, October 28, 2013 02:04:19 PM RUC_SoftSec wrote: > 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 > --- > 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) "if (!table)" perhaps? > + return AE_OK; And why is it a good idea to return success then? > > if (table_offset + table->length > all_tables_size) { > acpi_os_unmap_memory(table, ACPI_HEADER_SIZE); > Thanks! -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.