From: Colin Ian King <colin.king@xxxxxxxxxxxxx> The allocation for *gfn_track should be for a slot->npages lot of short integers, however the current allocation is using sizeof(*gfn_track) and that is the size of a pointer, which is too large. Fix this by using sizeof(**gfn_track) instead. Addresses-Coverity: ("Wrong sizeof argument") Fixes: 35b330bba6a7 ("KVM: x86: only allocate gfn_track when necessary") Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx> --- arch/x86/kvm/mmu/page_track.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c index bb5d60bd4dbf..5b785a5f7dc9 100644 --- a/arch/x86/kvm/mmu/page_track.c +++ b/arch/x86/kvm/mmu/page_track.c @@ -92,7 +92,7 @@ int kvm_page_track_enable_mmu_write_tracking(struct kvm *kvm) slots = __kvm_memslots(kvm, i); kvm_for_each_memslot(slot, slots) { gfn_track = slot->arch.gfn_track + KVM_PAGE_TRACK_WRITE; - *gfn_track = kvcalloc(slot->npages, sizeof(*gfn_track), + *gfn_track = kvcalloc(slot->npages, sizeof(**gfn_track), GFP_KERNEL_ACCOUNT); if (*gfn_track == NULL) { mutex_unlock(&kvm->slots_arch_lock); -- 2.32.0