xen: change the limit of nr_extents to UINT_MAX >> MEMOP_EXTENT_SHIFT
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 17 Oct 2012 15:43:50 +0000 (16:43 +0100)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 17 Oct 2012 15:43:50 +0000 (16:43 +0100)
Currently do_memory_op has a different maximum limit for nr_extents on
32 bit and 64 bit.
Change the limit to UINT_MAX >> MEMOP_EXTENT_SHIFT, so that it is the
same in both cases.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen/common/memory.c

index 5bcb0350865a21039385a48ef6452c5c0296c5fb..401d06c7d638f7d030946302aac0b6cc4d2086fd 100644 (file)
@@ -540,7 +540,7 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE(void) arg)
             return start_extent;
 
         /* Is size too large for us to encode a continuation? */
-        if ( reservation.nr_extents > (ULONG_MAX >> MEMOP_EXTENT_SHIFT) )
+        if ( reservation.nr_extents > (UINT_MAX >> MEMOP_EXTENT_SHIFT) )
             return start_extent;
 
         if ( unlikely(start_extent >= reservation.nr_extents) )