public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: matthieu castet <castet.matthieu@free.fr>
Cc: linux-acpi@vger.kernel.org
Subject: Re: [PATCH] check that acpi_wakeup_address is below 1MB
Date: Wed, 6 Feb 2008 23:56:36 +0100	[thread overview]
Message-ID: <20080206225636.GC4316@elte.hu> (raw)
In-Reply-To: <47AA38EF.6030307@free.fr>


* matthieu castet <castet.matthieu@free.fr> wrote:

> Hi,
>
> this patch had a check that the memory allocated is in the first 1MB.
> The check is similar to the one in smp_alloc_memory.
>
>
> Signed-off-by: "Matthieu CASTET <castet.matthieu@free.fr>"

> diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
> index 6bc815c..65ab23c 100644
> --- a/arch/x86/kernel/acpi/sleep.c
> +++ b/arch/x86/kernel/acpi/sleep.c
> @@ -65,6 +65,10 @@ void __init acpi_reserve_bootmem(void)
>  	acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE*2);
>  	if (!acpi_wakeup_address)
>  		printk(KERN_ERR "ACPI: Cannot allocate lowmem, S3 disabled.\n");
> +
> +	/* check if we are in first 1MB of memory */
> +	if (__pa(acpi_wakeup_address) >= 1024*1024-PAGE_SIZE*2)
> +		BUG();

please never BUG() out unless totally unavoidable - especially in such 
early bootup code - that might prevent people from being able to report 
anything beyond 'my bootup hung'.

print a WARN_ON() (that way kerneloops.org can pick it up), and perhaps 
disable ACPI sleep functionality. BUG()-ing out is way too drastic and 
way too user-unfriendly.

	Ingo

  reply	other threads:[~2008-02-06 22:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 22:47 [PATCH] check that acpi_wakeup_address is below 1MB matthieu castet
2008-02-06 22:56 ` Ingo Molnar [this message]
2008-02-06 23:10 ` 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=20080206225636.GC4316@elte.hu \
    --to=mingo@elte.hu \
    --cc=castet.matthieu@free.fr \
    --cc=linux-acpi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox