diff mbox

KVM x86: remove memset, use vzalloc and don't assign the same value to a variable twice

Message ID alpine.LNX.2.00.1010302020150.1572@swampdragon.chaosbits.net (mailing list archive)
State New, archived
Headers show

Commit Message

Jesper Juhl Oct. 30, 2010, 6:28 p.m. UTC
None
diff mbox

Patch

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);