All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Kelly <martin@martingkelly.com>
To: xen-devel@lists.xenproject.org, x86@kernel.org
Cc: mingo@redhat.com, david.vrabel@citrix.com,
	Martin Kelly <martkell@amazon.com>,
	boris.ostrovsky@oracle.com, tglx@linutronix.de
Subject: Re: [PATCH] xen/setup: add paranoid index check and warning
Date: Mon, 13 Oct 2014 18:19:05 -0700	[thread overview]
Message-ID: <543C7A09.4080006@martingkelly.com> (raw)
In-Reply-To: <1413249063-26088-1-git-send-email-martin@martingkelly.com>

On 10/13/2014 06:11 PM, Martin Kelly wrote:
> In a call to set_phys_range_identity, i-1 is used without checking that
> i is non-zero. Although unlikely, a bug in the code before it could
> cause the value to be 0, leading to erroneous behavior. This patch adds
> a check against 0 value and a corresponding warning.
> 
> Signed-off-by: Martin Kelly <martkell@amazon.com>
> ---
>  arch/x86/xen/setup.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> index af72161..26e39af 100644
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -671,7 +671,10 @@ char * __init xen_memory_setup(void)
>  	 * PFNs above MAX_P2M_PFN are considered identity mapped as
>  	 * well.
>  	 */
> -	set_phys_range_identity(map[i-1].addr / PAGE_SIZE, ~0ul);
> +	if (i > 0)
> +		set_phys_range_identity(map[i-1].addr / PAGE_SIZE, ~0ul);
> +	else
> +		WARN(1, "Something went wrong clamping memory to a factor of EXTRA_MEM_RATIO!");
>  
>  	/*
>  	 * In domU, the ISA region is normal, usable memory, but we
> 

Forgot to add linux-kernel@vger.kernel.org; resending.

  reply	other threads:[~2014-10-14  1:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14  1:11 [PATCH] xen/setup: add paranoid index check and warning Martin Kelly
2014-10-14  1:19 ` Martin Kelly [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-10-14  1:19 Martin Kelly
2014-10-14  1:19 Martin Kelly
2014-10-14  9:22 ` David Vrabel
2014-10-14  9:22 ` David Vrabel
2014-10-14 14:04   ` Martin Kelly
2014-10-14 14:04   ` Martin Kelly
2014-10-14 16:09     ` David Vrabel
2014-10-14 16:09     ` David Vrabel
2014-10-14 16:28       ` Martin Kelly
2014-10-14 16:28       ` Martin Kelly
2014-10-17  3:49         ` Martin Kelly
2014-10-17  3:49         ` Martin Kelly

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=543C7A09.4080006@martingkelly.com \
    --to=martin@martingkelly.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=martkell@amazon.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.