From: David Vrabel Date: Mon, 23 Jun 2014 17:56:59 +0000 (+0100) Subject: tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4757 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ecc7647b37b179465244add2468552a33025f14d;p=xen.git tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj Signed-off-by: David Vrabel Acked-by: Christoph Egger Acked-by: Ian Campbell --- diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/tests/mce-test/tools/xen-mceinj.c index 51ca17555e..d4f889bcf3 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 ) {