Skip to content

Commit ee5c38a

Browse files
keesMarc Zyngier
authored andcommitted
KVM: arm64: vgic: Handle const qualifier from gic_kvm_info allocation type
In preparation for making the kmalloc family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) The assigned type is "struct gic_kvm_info", but the returned type, while matching, is const qualified. To get them exactly matching, just use the dereferenced pointer for the sizeof(). Signed-off-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20260206223022.it.052-kees@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 02471a7 commit ee5c38a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/kvm/vgic/vgic-init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static struct gic_kvm_info *gic_kvm_info;
654654
void __init vgic_set_kvm_info(const struct gic_kvm_info *info)
655655
{
656656
BUG_ON(gic_kvm_info != NULL);
657-
gic_kvm_info = kmalloc(sizeof(*info), GFP_KERNEL);
657+
gic_kvm_info = kmalloc(sizeof(*gic_kvm_info), GFP_KERNEL);
658658
if (gic_kvm_info)
659659
*gic_kvm_info = *info;
660660
}

0 commit comments

Comments
 (0)