diff options
author | Tian Tao <tiantao6@hisilicon.com> | 2021-01-25 11:57:25 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-02-04 05:27:15 -0500 |
commit | c910662c7c696ec0769766aaee5fc2fb54d921d5 (patch) | |
tree | e7788f5869f632eb6b772c7f120ef04fd27d9ef1 /virt/kvm | |
parent | 15b51dc08a349f2f0832606c900b638a3dd19839 (diff) |
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: Tian Tao <tiantao6@hisilicon.com>
Message-Id: <1611547045-13669-1-git-send-email-tiantao6@hisilicon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/dirty_ring.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/virt/kvm/dirty_ring.c b/virt/kvm/dirty_ring.c index 9d01299563ee..790f17325f8d 100644 --- a/virt/kvm/dirty_ring.c +++ b/virt/kvm/dirty_ring.c @@ -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(); |