Commit c910662c authored by Tian Tao's avatar Tian Tao Committed by Paolo Bonzini

KVM: X86: use vzalloc() instead of vmalloc/memset

fixed the following warning:
/virt/kvm/dirty_ring.c:70:20-27: WARNING: vzalloc should be used for
ring -> dirty_gfns, instead of vmalloc/memset.
Signed-off-by: default avatarTian Tao <tiantao6@hisilicon.com>
Message-Id: <1611547045-13669-1-git-send-email-tiantao6@hisilicon.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 15b51dc0
...@@ -67,10 +67,9 @@ static void kvm_reset_dirty_gfn(struct kvm *kvm, u32 slot, u64 offset, u64 mask) ...@@ -67,10 +67,9 @@ static void kvm_reset_dirty_gfn(struct kvm *kvm, u32 slot, u64 offset, u64 mask)
int kvm_dirty_ring_alloc(struct kvm_dirty_ring *ring, int index, u32 size) int kvm_dirty_ring_alloc(struct kvm_dirty_ring *ring, int index, u32 size)
{ {
ring->dirty_gfns = vmalloc(size); ring->dirty_gfns = vzalloc(size);
if (!ring->dirty_gfns) if (!ring->dirty_gfns)
return -ENOMEM; return -ENOMEM;
memset(ring->dirty_gfns, 0, size);
ring->size = size / sizeof(struct kvm_dirty_gfn); ring->size = size / sizeof(struct kvm_dirty_gfn);
ring->soft_limit = ring->size - kvm_dirty_ring_get_rsvd_entries(); ring->soft_limit = ring->size - kvm_dirty_ring_get_rsvd_entries();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment