From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 471BB397686; Tue, 3 Mar 2026 19:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772566445; cv=none; b=JEWWAEqKKAc9bcXjuGX2VCnXusOja8EdMHu3JmyitxVRkvRULAQLlMH60hwHbeQlGM4kjTw8TQuskttCo4qTJ26qRj0cl6W5HyIHi+fHIL1hamtdDoUpIUAwid0kDENkR+444zNqawZNxRDIi43yiDM+YGGqivqXGLEGtby5RCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772566445; c=relaxed/simple; bh=XNSxifEFf2irY46BpjtXhqwA8XGnDUzWVeM5fRdCTb8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AFBEXibqZJK50F/D5zP9XKOLdJlBhCd4NTPTBwAHrBt4rcam4RBag7XzmSijCddB1ors4e7aZMiuphcUkg+2E6WYKdSxZrNr9ZReaAUEJkRuDKGrraaxd+OyPXmoQprDmiaW19kORPc/SXotDUXJmsXynu9i82OSFrmNe/wOrcM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gC6G77/o; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gC6G77/o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAD30C116C6; Tue, 3 Mar 2026 19:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772566445; bh=XNSxifEFf2irY46BpjtXhqwA8XGnDUzWVeM5fRdCTb8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gC6G77/oeW8p4NXlyLn6UCy3gtHjA8Nj0dRRH2/liP8nHLq7QF9QUxaq98huKTstn BGT3L1538Sdjm2VWaDskM6pl8gVfB2NoPmla+XHodrHSJimM4Rmi/itXdXwQbdNb3o UWogD5C53UWVbwn0fiPe8uD6URMB95qolyuejUFr8NQB5y56SOSOy4Z/NKoFED+q2N BPHaySs3Pn0x0/LYgaLCjAQU8Qsl7RpwFbZ21LKOIN/8CR7tdx/A7RfbKEe++yFMpy LZZtlzYJGiUosgcklcUVVUv9gBD0S7XuasZxrAQG/f/nvKGB93MEEeNA5/Bc5SQ3PI u552hl557d62w== Message-ID: <0b06d473-4116-472f-8908-4f36d204b2e2@kernel.org> Date: Tue, 3 Mar 2026 20:34:01 +0100 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] KVM: PPC: e500: Fix build error due to using kmalloc_obj() with wrong type To: Sean Christopherson , Madhavan Srinivasan Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook References: <20260303190339.974325-1-seanjc@google.com> <20260303190339.974325-2-seanjc@google.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260303190339.974325-2-seanjc@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 > Signed-off-by: Sean Christopherson Reviewed-by: Christophe Leroy (CS GROUP) > --- > 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;