mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf()
@ 2023-03-15  8:59 Denis Orlov
  2023-03-15  8:59 ` [PATCH 1/3] MIPS: bootm: do not free fdt pointer that contains an error Denis Orlov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Denis Orlov @ 2023-03-15  8:59 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Denis Orlov (3):
  MIPS: bootm: do not free fdt pointer that contains an error
  MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()
  MIPS: bootm: remove unnecessary phys/virt conversions

 arch/mips/lib/bootm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.30.2




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

* [PATCH 1/3] MIPS: bootm: do not free fdt pointer that contains an error
  2023-03-15  8:59 [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Denis Orlov
@ 2023-03-15  8:59 ` Denis Orlov
  2023-03-15  8:59 ` [PATCH 2/3] MIPS: bootm: do not leak memory on error in of_overlay_load_firmware() Denis Orlov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Denis Orlov @ 2023-03-15  8:59 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Also add a proper error message.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 arch/mips/lib/bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 655535737e..95e9dc0d7d 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -57,8 +57,8 @@ static int do_bootm_elf(struct image_data *data)
 
 	fdt = bootm_get_devicetree(data);
 	if (IS_ERR(fdt)) {
-		ret = PTR_ERR(fdt);
-		goto bootm_free_fdt;
+		pr_err("Failed to load dtb\n");
+		return PTR_ERR(fdt);
 	}
 
 	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
-- 
2.30.2




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

* [PATCH 2/3] MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()
  2023-03-15  8:59 [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Denis Orlov
  2023-03-15  8:59 ` [PATCH 1/3] MIPS: bootm: do not free fdt pointer that contains an error Denis Orlov
@ 2023-03-15  8:59 ` Denis Orlov
  2023-03-15  8:59 ` [PATCH 3/3] MIPS: bootm: remove unnecessary phys/virt conversions Denis Orlov
  2023-03-16  8:59 ` [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Denis Orlov @ 2023-03-15  8:59 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 arch/mips/lib/bootm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 95e9dc0d7d..69ce9b3904 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -69,7 +69,7 @@ static int do_bootm_elf(struct image_data *data)
 
 	ret = of_overlay_load_firmware();
 	if (ret)
-		return ret;
+		goto bootm_free_fdt;
 
 	shutdown_barebox();
 
-- 
2.30.2




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

* [PATCH 3/3] MIPS: bootm: remove unnecessary phys/virt conversions
  2023-03-15  8:59 [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Denis Orlov
  2023-03-15  8:59 ` [PATCH 1/3] MIPS: bootm: do not free fdt pointer that contains an error Denis Orlov
  2023-03-15  8:59 ` [PATCH 2/3] MIPS: bootm: do not leak memory on error in of_overlay_load_firmware() Denis Orlov
@ 2023-03-15  8:59 ` Denis Orlov
  2023-03-16  8:59 ` [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Denis Orlov @ 2023-03-15  8:59 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

They are not doing anything there - we should already have proper
virtual addresses represented by those pointers.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 arch/mips/lib/bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 69ce9b3904..19d82ec375 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -62,7 +62,7 @@ static int do_bootm_elf(struct image_data *data)
 	}
 
 	pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
-		phys_to_virt(data->os_address), data->of_root_node);
+		data->os_address, data->of_root_node);
 
 	if (data->dryrun)
 		goto bootm_free_fdt;
@@ -75,7 +75,7 @@ static int do_bootm_elf(struct image_data *data)
 
 	entry = (void *) (unsigned long) data->os_address;
 
-	entry(-2, phys_to_virt((unsigned long)fdt));
+	entry(-2, fdt);
 
 	pr_err("ELF application terminated\n");
 	ret = -EINVAL;
-- 
2.30.2




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

* Re: [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf()
  2023-03-15  8:59 [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Denis Orlov
                   ` (2 preceding siblings ...)
  2023-03-15  8:59 ` [PATCH 3/3] MIPS: bootm: remove unnecessary phys/virt conversions Denis Orlov
@ 2023-03-16  8:59 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2023-03-16  8:59 UTC (permalink / raw)
  To: Denis Orlov; +Cc: barebox

On Wed, Mar 15, 2023 at 11:59:50AM +0300, Denis Orlov wrote:
> Denis Orlov (3):
>   MIPS: bootm: do not free fdt pointer that contains an error
>   MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()
>   MIPS: bootm: remove unnecessary phys/virt conversions
> 
>  arch/mips/lib/bootm.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-03-16  9:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15  8:59 [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Denis Orlov
2023-03-15  8:59 ` [PATCH 1/3] MIPS: bootm: do not free fdt pointer that contains an error Denis Orlov
2023-03-15  8:59 ` [PATCH 2/3] MIPS: bootm: do not leak memory on error in of_overlay_load_firmware() Denis Orlov
2023-03-15  8:59 ` [PATCH 3/3] MIPS: bootm: remove unnecessary phys/virt conversions Denis Orlov
2023-03-16  8:59 ` [PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf() Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox