All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing
@ 2019-09-04  7:53 Fabien Dessenne
  2019-09-04  7:57 ` Lokesh Vutla
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fabien Dessenne @ 2019-09-04  7:53 UTC (permalink / raw)
  To: u-boot

Fix an issue where some sections are never loaded : if p_type is
different from PT_LOAD the phdr pointer must be incremented.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing
  2019-09-04  7:53 [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing Fabien Dessenne
@ 2019-09-04  7:57 ` Lokesh Vutla
  2019-10-11 19:35 ` Suman Anna
  2020-01-25 17:08 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Lokesh Vutla @ 2019-09-04  7:57 UTC (permalink / raw)
  To: u-boot



On 04/09/19 1:23 PM, 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.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

> ---
>  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;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing
  2019-09-04  7:53 [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing Fabien Dessenne
  2019-09-04  7:57 ` Lokesh Vutla
@ 2019-10-11 19:35 ` Suman Anna
  2020-01-25 17:08 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Suman Anna @ 2019-10-11 19:35 UTC (permalink / raw)
  To: u-boot

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@st.com>

Acked-by: Suman Anna <s-anna@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;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing
  2019-09-04  7:53 [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing Fabien Dessenne
  2019-09-04  7:57 ` Lokesh Vutla
  2019-10-11 19:35 ` Suman Anna
@ 2020-01-25 17:08 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2020-01-25 17:08 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 04, 2019 at 09:53:22AM +0200, 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.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> Acked-by: Suman Anna <s-anna@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200125/06077185/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-25 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04  7:53 [U-Boot] [PATCH] remoteproc: elf_loader: fix program header parsing Fabien Dessenne
2019-09-04  7:57 ` Lokesh Vutla
2019-10-11 19:35 ` Suman Anna
2020-01-25 17:08 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.