Skip to content

Commit 4c01346

Browse files
sean-jcbonzini
authored andcommitted
KVM: PPC: e500: Fix build error due to using kmalloc_obj() with wrong type
Fix a build error in kvmppc_e500_tlb_init() that was introduced by the conversion to use kzalloc_objs(), as KVM confusingly uses the size of the structure that is one and only field in tlbe_priv: arch/powerpc/kvm/e500_mmu.c:923:33: error: assignment to 'struct tlbe_priv *' from incompatible pointer type 'struct tlbe_ref *' [-Wincompatible-pointer-types] 923 | vcpu_e500->gtlb_priv[0] = kzalloc_objs(struct tlbe_ref, | ^ KVM has been flawed since commit 0164c0f ("KVM: PPC: e500: clear up confusion between host and guest entries"), but the issue went unnoticed until kmalloc_obj() came along and enforced types, as "struct tlbe_priv" was just a wrapper of "struct tlbe_ref" (why on earth the two ever existed separately...). Fixes: 69050f8 ("treewide: Replace kmalloc with kmalloc_obj for non-scalar types") Cc: Kees Cook <kees@kernel.org> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Link: https://patch.msgid.link/20260303190339.974325-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent cf534a0 commit 4c01346

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/powerpc/kvm/e500_mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,12 +920,12 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500)
920920
vcpu_e500->gtlb_offset[0] = 0;
921921
vcpu_e500->gtlb_offset[1] = KVM_E500_TLB0_SIZE;
922922

923-
vcpu_e500->gtlb_priv[0] = kzalloc_objs(struct tlbe_ref,
923+
vcpu_e500->gtlb_priv[0] = kzalloc_objs(struct tlbe_priv,
924924
vcpu_e500->gtlb_params[0].entries);
925925
if (!vcpu_e500->gtlb_priv[0])
926926
goto free_vcpu;
927927

928-
vcpu_e500->gtlb_priv[1] = kzalloc_objs(struct tlbe_ref,
928+
vcpu_e500->gtlb_priv[1] = kzalloc_objs(struct tlbe_priv,
929929
vcpu_e500->gtlb_params[1].entries);
930930
if (!vcpu_e500->gtlb_priv[1])
931931
goto free_vcpu;

0 commit comments

Comments
 (0)