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

[Xen-devel] [PATCH 2 of 7 v2] x86/mm: Another couple of comparisons of unsigned vars with < 0


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Tim Deegan <tim@xxxxxxx>
  • Date: Thu, 5 Apr 2012 16:51:51 +0100
  • Delivery-date: Thu, 05 Apr 2012 16:09:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1333640955 -3600
# Node ID 08612e81926857363618746fd01f9b08b7c3ac73
# Parent  7922a921d2034930780e41f1bc71d2c4ddb3b782
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 <tim@xxxxxxx>

diff -r 7922a921d203 -r 08612e819268 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c     Thu Apr 05 16:49:15 2012 +0100
@@ -1305,7 +1305,7 @@ int p2m_set_mem_access(struct domain *d,
         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,
     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];

_______________________________________________
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®.