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

[Xen-changelog] [xen master] tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj



commit ecc7647b37b179465244add2468552a33025f14d
Author:     David Vrabel <david.vrabel@xxxxxxxxxx>
AuthorDate: Mon Jun 23 18:56:59 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Jun 27 14:13:23 2014 +0100

    tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj
    
    Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
    Acked-by: Christoph Egger <chegger@xxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/tests/mce-test/tools/xen-mceinj.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tools/tests/mce-test/tools/xen-mceinj.c 
b/tools/tests/mce-test/tools/xen-mceinj.c
index 51ca175..d4f889b 100644
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/tests/mce-test/tools/xen-mceinj.c
@@ -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 ) {
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.