Skip to content

Commit

Permalink
KVM: X86: use vzalloc() instead of vmalloc/memset
Browse files Browse the repository at this point in the history
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: Tian Tao <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Tian Tao authored and bonzini committed Feb 4, 2021
1 parent 15b51dc commit c910662
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions virt/kvm/dirty_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
ring->dirty_gfns = vmalloc(size);
ring->dirty_gfns = vzalloc(size);
if (!ring->dirty_gfns)
return -ENOMEM;
memset(ring->dirty_gfns, 0, size);

ring->size = size / sizeof(struct kvm_dirty_gfn);
ring->soft_limit = ring->size - kvm_dirty_ring_get_rsvd_entries();
Expand Down

0 comments on commit c910662

Please sign in to comment.