[U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing
Suman Anna
s-anna at ti.com
Fri Oct 11 19:35:35 UTC 2019
On 9/4/19 2:53 AM, Fabien Dessenne wrote:
> Fix an issue where some sections are never loaded : if p_type is
> different from PT_LOAD the phdr pointer must be incremented.
>
Good catch Fabien.
Fixes: 7a7c4cb0f044 ("remoteproc: add elf file load support")
> Signed-off-by: Fabien Dessenne <fabien.dessenne at st.com>
Acked-by: Suman Anna <s-anna at ti.com>
regards
Suman
> ---
> drivers/remoteproc/rproc-elf-loader.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c
> index 67937a7..23d502d 100644
> --- a/drivers/remoteproc/rproc-elf-loader.c
> +++ b/drivers/remoteproc/rproc-elf-loader.c
> @@ -78,7 +78,7 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
> ops = rproc_get_ops(dev);
>
> /* Load each program header */
> - for (i = 0; i < ehdr->e_phnum; ++i) {
> + for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
> void *dst = (void *)(uintptr_t)phdr->p_paddr;
> void *src = (void *)addr + phdr->p_offset;
>
> @@ -99,7 +99,6 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
> roundup((unsigned long)dst + phdr->p_filesz,
> ARCH_DMA_MINALIGN) -
> rounddown((unsigned long)dst, ARCH_DMA_MINALIGN));
> - ++phdr;
> }
>
> return 0;
>
More information about the U-Boot
mailing list