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

[Xen-devel] [PATCH 3/5] tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj



Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
 tools/tests/mce-test/tools/xen-mceinj.c |    3 +--
 1 file changed, 1 insertion(+), 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 ) {
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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