From: Tim Deegan Date: Wed, 11 Apr 2012 12:10:33 +0000 (+0100) Subject: x86/mm: Another couple of comparisons of unsigned vars with < 0. X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b656ffb608274ad3cd39cbfdb23adf697bfc36ea;p=xen.git x86/mm: Another couple of comparisons of unsigned vars with < 0. Adding the explicit (unsigned) casts in case enums ever end up signed. Signed-off-by: Tim Deegan Acked-by: Keir Fraser Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index b0ae3411d3..599ea9310e 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1305,7 +1305,7 @@ int p2m_set_mem_access(struct domain *d, unsigned long start_pfn, p2m->default_access, }; - if ( access >= HVMMEM_access_default || access < 0 ) + if ( (unsigned) access >= HVMMEM_access_default ) return -EINVAL; a = memaccess[access]; @@ -1367,7 +1367,7 @@ int p2m_get_mem_access(struct domain *d, unsigned long pfn, if ( mfn_x(mfn) == INVALID_MFN ) return -ESRCH; - if ( a >= ARRAY_SIZE(memaccess) || a < 0 ) + if ( (unsigned) a >= ARRAY_SIZE(memaccess) ) return -ERANGE; *access = memaccess[a];