]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mm: Another couple of comparisons of unsigned vars with < 0.
authorTim Deegan <tim@xen.org>
Wed, 11 Apr 2012 12:10:33 +0000 (13:10 +0100)
committerTim Deegan <tim@xen.org>
Wed, 11 Apr 2012 12:10:33 +0000 (13:10 +0100)
Adding the explicit (unsigned) casts in case enums ever end up signed.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c

index b0ae3411d3327283639bb2b85320936e68eb9e47..599ea9310e15419105639d08d1f4d287c283c80d 100644 (file)
@@ -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];