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

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 <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)

"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.

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28  6:04 [PATCH 1/1] acpi: check return value of acpi_os_map_memory RUC_SoftSec
2013-10-28 11:01 ` Rafael J. Wysocki [this message]

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=3198340.cKCt9ZmSgp@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rucsoftsec@gmail.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