public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Sean Christopherson <seanjc@google.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Kees Cook <kees@kernel.org>
Subject: Re: [PATCH 1/2] KVM: PPC: e500: Fix build error due to using kmalloc_obj() with wrong type
Date: Tue, 3 Mar 2026 20:34:01 +0100	[thread overview]
Message-ID: <0b06d473-4116-472f-8908-4f36d204b2e2@kernel.org> (raw)
In-Reply-To: <20260303190339.974325-2-seanjc@google.com>



Le 03/03/2026 à 20:03, Sean Christopherson a écrit :
> 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 0164c0f0c404 ("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: 69050f8d6d07 ("treewide: Replace kmalloc with kmalloc_obj for non-scalar types")
> Cc: Kees Cook <kees@kernel.org>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>

> ---
>   arch/powerpc/kvm/e500_mmu.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c
> index 48580c85f23b..75ed1496ead5 100644
> --- a/arch/powerpc/kvm/e500_mmu.c
> +++ b/arch/powerpc/kvm/e500_mmu.c
> @@ -920,12 +920,12 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500)
>   	vcpu_e500->gtlb_offset[0] = 0;
>   	vcpu_e500->gtlb_offset[1] = KVM_E500_TLB0_SIZE;
>   
> -	vcpu_e500->gtlb_priv[0] = kzalloc_objs(struct tlbe_ref,
> +	vcpu_e500->gtlb_priv[0] = kzalloc_objs(struct tlbe_priv,
>   					       vcpu_e500->gtlb_params[0].entries);
>   	if (!vcpu_e500->gtlb_priv[0])
>   		goto free_vcpu;
>   
> -	vcpu_e500->gtlb_priv[1] = kzalloc_objs(struct tlbe_ref,
> +	vcpu_e500->gtlb_priv[1] = kzalloc_objs(struct tlbe_priv,
>   					       vcpu_e500->gtlb_params[1].entries);
>   	if (!vcpu_e500->gtlb_priv[1])
>   		goto free_vcpu;



  reply	other threads:[~2026-03-03 19:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 19:03 [PATCH 0/2] KVM: PPC: e500: Fix build error due to crappy KVM code Sean Christopherson
2026-03-03 19:03 ` [PATCH 1/2] KVM: PPC: e500: Fix build error due to using kmalloc_obj() with wrong type Sean Christopherson
2026-03-03 19:34   ` Christophe Leroy (CS GROUP) [this message]
2026-03-03 19:03 ` [PATCH 2/2] KVM: PPC: e500: Rip out "struct tlbe_ref" Sean Christopherson
2026-03-05 17:07 ` [PATCH 0/2] KVM: PPC: e500: Fix build error due to crappy KVM code Sean Christopherson
2026-03-06  4:02   ` Madhavan Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b06d473-4116-472f-8908-4f36d204b2e2@kernel.org \
    --to=chleroy@kernel.org \
    --cc=kees@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox