From patchwork Fri Nov 5 03:07:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 303592 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 oA53INkZ012133 for ; Fri, 5 Nov 2010 03:18:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753514Ab0KEDIl (ORCPT ); Thu, 4 Nov 2010 23:08:41 -0400 Received: from mail.perches.com ([173.55.12.10]:4054 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753475Ab0KEDIh (ORCPT ); Thu, 4 Nov 2010 23:08:37 -0400 Received: from Joe-Laptop.home (unknown [192.168.1.162]) by mail.perches.com (Postfix) with ESMTP id 1B6C62436E; Thu, 4 Nov 2010 19:08:30 -0800 (PST) From: Joe Perches To: Jiri Kosina Cc: Andreas Herrmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Avi Kivity , Marcelo Tosatti , amd64-microcode@amd64.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH 05/49] arch/x86: Use vzalloc Date: Thu, 4 Nov 2010 20:07:29 -0700 Message-Id: <9eb79212eddaa03ff3e7ddc88bc59b7564ea317c.1288925424.git.joe@perches.com> X-Mailer: git-send-email 1.7.3.1.g432b3.dirty In-Reply-To: References: In-Reply-To: References: 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]); Fri, 05 Nov 2010 03:18:24 +0000 (UTC) diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index e1af7c0..d46e805 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c @@ -183,9 +183,8 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size) return NULL; } - mc = vmalloc(UCODE_MAX_SIZE); + mc = vzalloc(UCODE_MAX_SIZE); if (mc) { - memset(mc, 0, UCODE_MAX_SIZE); if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) { vfree(mc); 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); diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index e1d1069..b008656 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c @@ -123,12 +123,11 @@ static int pageattr_test(void) if (print) printk(KERN_INFO "CPA self-test:\n"); - bm = vmalloc((max_pfn_mapped + 7) / 8); + bm = vzalloc((max_pfn_mapped + 7) / 8); if (!bm) { printk(KERN_ERR "CPA Cannot vmalloc bitmap\n"); return -ENOMEM; } - memset(bm, 0, (max_pfn_mapped + 7) / 8); failed += print_split(&sa); srandom32(100);