From ea20dd2b2237c793066621c2dec453f05134d074 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 1 Feb 2017 20:10:26 +0100 Subject: [PATCH] ia64: Fix iterator for relocation entries. Don't assume relocation entry size and use sh_entsize properly. --- grub-core/kern/ia64/dl_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/ia64/dl_helper.c b/grub-core/kern/ia64/dl_helper.c index 2436b75fd..f663a52d5 100644 --- a/grub-core/kern/ia64/dl_helper.c +++ b/grub-core/kern/ia64/dl_helper.c @@ -216,11 +216,11 @@ grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize))) if (s->sh_type == grub_cpu_to_le32_compile_time (SHT_RELA)) { - Elf64_Rela *rel, *max; + const Elf64_Rela *rel, *max; for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu64 (s->sh_offset)), - max = rel + grub_le_to_cpu64 (s->sh_size) / grub_le_to_cpu64 (s->sh_entsize); - rel < max; rel++) + max = (const Elf64_Rela *) ((grub_addr_t) rel + grub_le_to_cpu64 (s->sh_size)); + rel < max; rel = (const Elf64_Rela *) ((grub_addr_t) rel + grub_le_to_cpu64 (s->sh_entsize))) switch (ELF64_R_TYPE (grub_le_to_cpu64 (rel->r_info))) { case R_IA64_PCREL21B: