]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxc: don't pass uninitialized data to do_dm_op()
authorJan Beulich <JBeulich@suse.com>
Mon, 20 Feb 2017 16:53:27 +0000 (16:53 +0000)
committerWei Liu <wei.liu2@citrix.com>
Mon, 20 Feb 2017 16:53:27 +0000 (16:53 +0000)
do_dm_op() expects (void *, size_t) pairs, but with nr being uint32_t
the type of the expression of xc_hvm_track_dirty_vram()'s last argument
to the function is only a 32 bits one. Neither C nor the ABI require
the compiler to promote the type beyond int.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_misc.c

index 0fc6c22a2e0a69efee7003155cda7ea466b7fe9a..5159475b293faf1ceaf67aa81b693a7dbef3e019 100644 (file)
@@ -560,7 +560,7 @@ int xc_hvm_track_dirty_vram(
     data->nr = nr;
 
     return do_dm_op(xch, dom, 2, &op, sizeof(op),
-                    dirty_bitmap, (nr + 7) / 8);
+                    dirty_bitmap, (size_t)((nr + 7) / 8));
 }
 
 int xc_hvm_modified_memory(