]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: vgic-v5: Cast vgic_apr to u32 to avoid undefined behaviours
authorMarc Zyngier <maz@kernel.org>
Wed, 1 Apr 2026 10:36:03 +0000 (11:36 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 1 Apr 2026 14:42:26 +0000 (15:42 +0100)
commit42d7eac8291d2724b3897141ab2f226c69b7923e
tree9d0d88218d2d8462b6cdf8ba321f5dca6645a706
parent170a77b4185a87cc7e02e404d22b9bf3f9923884
KVM: arm64: vgic-v5: Cast vgic_apr to u32 to avoid undefined behaviours

Passing a u64 to __builtin_ctz() is odd, and requires some digging to
figure out why this construct is indeed safe as long as the HW is
correct.

But it is much easier to make it clear to the compiler by casting
the u64 into an intermediate u32, and be done with the UD.

Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Fixes: 933e5288fa971 ("KVM: arm64: gic-v5: Check for pending PPIs")
Link: https://sashiko.dev/#/patchset/20260319154937.3619520-1-sascha.bischoff%40arm.com
Link: https://patch.msgid.link/20260401103611.357092-9-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/vgic/vgic-v5.c