[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/setup: add paranoid index check and warning



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx; resending.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.