]> xenbits.xensource.com Git - xen.git/commitdiff
tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj
authorDavid Vrabel <david.vrabel@citrix.com>
Mon, 23 Jun 2014 17:56:59 +0000 (18:56 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 27 Jun 2014 13:13:23 +0000 (14:13 +0100)
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/tests/mce-test/tools/xen-mceinj.c

index 51ca17555ec2dac821671baa450e3f60c05114cb..d4f889bcf3c4012f41201b3302c8139001792242 100644 (file)
@@ -284,10 +284,9 @@ static uint64_t guest_mfn(xc_interface *xc_handle,
         err(xc_handle, "Failed to get platform information");
 
     /* Get guest's pfn list */
-    pfn_buf = malloc(sizeof(uint64_t) * max_gpfn);
+    pfn_buf = calloc(max_gpfn, sizeof(uint64_t));
     if ( !pfn_buf )
         err(xc_handle, "Failed to alloc pfn buf");
-    memset(pfn_buf, 0, sizeof(uint64_t) * max_gpfn);
 
     ret = xc_get_pfn_list(xc_handle, domain, pfn_buf, max_gpfn);
     if ( ret < 0 ) {