From b35c610aca1cd5d76b3cb2193e7698011de3142b Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 5 Jan 2023 23:24:26 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Fix calculation for number of relocs in .hyp.reloc Fix the calculation to determine the number of module relocs present in the '.hyp.reloc' section to divide by the size of 'kvm_nvhe_reloc_t' (4) instead of the size of a pointer (8). Fixes: ace50253904d ("ANDROID: KVM: arm64: Resolve hyp module addresses using ELF sections") Signed-off-by: Will Deacon Signed-off-by: Will Deacon Bug: 261855285 Change-Id: Ia7afc508039d549ae061793afa39fde9d844c069 --- arch/arm64/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index 30b7a4559c25..71737f6bdf6b 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c @@ -571,7 +571,7 @@ static int module_init_hyp(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, return -ENOEXEC; mod->arch.hyp.relocs = (void *)s->sh_addr; - mod->arch.hyp.nr_relocs = s->sh_size / sizeof(mod->arch.hyp.relocs); + mod->arch.hyp.nr_relocs = s->sh_size / sizeof(*mod->arch.hyp.relocs); #endif return 0; }