From: David Vrabel Subject: [PATCH 3/5] tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj Date: Mon, 23 Jun 2014 18:56:59 +0100 Message-ID: <1403546221-4149-4-git-send-email-david.vrabel@citrix.com> References: <1403546221-4149-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wz8UQ-0003yD-0S for xen-devel@lists.xenproject.org; Mon, 23 Jun 2014 17:57:10 +0000 In-Reply-To: <1403546221-4149-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Campbell , Stefano Stabellini , Liu Jinsong , Christoph Egger , Ian Jackson , David Vrabel List-Id: xen-devel@lists.xenproject.org Signed-off-by: David Vrabel --- 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