From patchwork Mon Nov 1 18:42:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 295462 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA1Ir5uU008536 for ; Mon, 1 Nov 2010 18:53:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753614Ab0KASwh (ORCPT ); Mon, 1 Nov 2010 14:52:37 -0400 Received: from swampdragon.chaosbits.net ([90.184.90.115]:20370 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753192Ab0KASwh (ORCPT ); Mon, 1 Nov 2010 14:52:37 -0400 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id C93DE94057; Mon, 1 Nov 2010 19:42:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id C67F094040; Mon, 1 Nov 2010 19:42:04 +0100 (CET) Date: Mon, 1 Nov 2010 19:42:04 +0100 (CET) From: Jesper Juhl To: Takuya Yoshikawa cc: kvm@vger.kernel.org, Avi Kivity , Avi Kivity , Marcelo Tosatti , Yaniv Kamay , Amit Shah , Ben-Ami Yassour , linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM x86: remove memset, use vzalloc and don't assign the same value to a variable twice In-Reply-To: <4CCE0EB2.9070302@oss.ntt.co.jp> Message-ID: References: <4CCE0EB2.9070302@oss.ntt.co.jp> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 01 Nov 2010 18:53:05 +0000 (UTC) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2288ad8..624d4da 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3174,10 +3174,9 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, spin_unlock(&kvm->mmu_lock); r = -ENOMEM; - dirty_bitmap = vmalloc(n); + dirty_bitmap = vzalloc(n); if (!dirty_bitmap) goto out; - memset(dirty_bitmap, 0, n); r = -ENOMEM; slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);