msm: pil: Assume program headers directly follow elf header
Some elf headers may not correctly state where the program
headers are. Instead of blindly trusting the elf header, assume
the program headers come directly after the elf header.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/peripheral-loader.c b/arch/arm/mach-msm/peripheral-loader.c
index af6f596..68d3235 100644
--- a/arch/arm/mach-msm/peripheral-loader.c
+++ b/arch/arm/mach-msm/peripheral-loader.c
@@ -190,7 +190,7 @@
goto release_fw;
}
- phdr = (const struct elf32_phdr *)(fw->data + ehdr->e_phoff);
+ phdr = (const struct elf32_phdr *)(fw->data + sizeof(struct elf32_hdr));
for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
if (!segment_is_loadable(phdr))
continue;