libxc: use correct return type for do_memory_op()
authorJuergen Gross <jgross@suse.com>
Fri, 27 Nov 2015 09:00:51 +0000 (10:00 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 1 Dec 2015 12:10:11 +0000 (12:10 +0000)
Currently do_memory_op() is returning int, while the hypervisor is
returning long. This will lead to wrong return informations as soon as
e.g. a pfn larger than about 2 billion (8 TB) is returned.

Use the correct long return type instead and correct the functions
expecting a pfn via the return value of do_memory_op().

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_domain.c
tools/libxc/xc_private.c
tools/libxc/xc_private.h

index e7278dd349d8d73ac9fdd15fae93b87ee004b5a7..83afc7545973a509d95252196fe80d3b159f28d1 100644 (file)
@@ -828,7 +828,7 @@ int xc_domain_get_tsc_info(xc_interface *xch,
 
 int xc_domain_maximum_gpfn(xc_interface *xch, domid_t domid, xen_pfn_t *gpfns)
 {
-    int rc = do_memory_op(xch, XENMEM_maximum_gpfn, &domid, sizeof(domid));
+    long rc = do_memory_op(xch, XENMEM_maximum_gpfn, &domid, sizeof(domid));
 
     if ( rc >= 0 )
     {
index 7c398974fe82b24c8ba436f409453c2d1cec7d9e..6c0c0d62a0e7bce681fbfc897d0a0679ad5e3465 100644 (file)
@@ -519,7 +519,7 @@ int xc_flush_mmu_updates(xc_interface *xch, struct xc_mmu *mmu)
     return flush_mmu_updates(xch, mmu);
 }
 
-int do_memory_op(xc_interface *xch, int cmd, void *arg, size_t len)
+long do_memory_op(xc_interface *xch, int cmd, void *arg, size_t len)
 {
     DECLARE_HYPERCALL;
     DECLARE_HYPERCALL_BOUNCE(arg, len, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
index 2df1d59fab094741b4255d2a6412238128f237f1..f603c15d29254d9077d4134cb58c37569a65b6e4 100644 (file)
@@ -374,7 +374,7 @@ static inline int do_multicall_op(xc_interface *xch,
     return ret;
 }
 
-int do_memory_op(xc_interface *xch, int cmd, void *arg, size_t len);
+long do_memory_op(xc_interface *xch, int cmd, void *arg, size_t len);
 
 void *xc_map_foreign_ranges(xc_interface *xch, uint32_t dom,
                             size_t size, int prot, size_t chunksize,