From patchwork Sat Oct 30 18:28:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 292392 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 o9UImPKE011231 for ; Sat, 30 Oct 2010 18:48:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755184Ab0J3SsO (ORCPT ); Sat, 30 Oct 2010 14:48:14 -0400 Received: from swampdragon.chaosbits.net ([90.184.90.115]:29545 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755339Ab0J3SsN (ORCPT ); Sat, 30 Oct 2010 14:48:13 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 30 Oct 2010 18:48:27 +0000 (UTC) X-Greylist: delayed 580 seconds by postgrey-1.27 at vger.kernel.org; Sat, 30 Oct 2010 14:48:13 EDT Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 1F6CE9403D; Sat, 30 Oct 2010 20:28:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 185639403B; Sat, 30 Oct 2010 20:28:17 +0200 (CEST) Date: Sat, 30 Oct 2010 20:28:17 +0200 (CEST) From: Jesper Juhl To: kvm@vger.kernel.org cc: Avi Kivity , Avi Kivity , Marcelo Tosatti , Yaniv Kamay , Amit Shah , Ben-Ami Yassour , linux-kernel@vger.kernel.org Subject: [PATCH] KVM x86: remove memset, use vzalloc and don't assign the same value to a variable twice Message-ID: 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 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2288ad8..29f9c0a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3174,12 +3174,10 @@ 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); if (!slots) { vfree(dirty_bitmap);