public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Prevent crash if random/invalid ramdisks are passed to bootm
@ 2008-08-30  0:08 Kumar Gala
  2008-09-06 22:19 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Kumar Gala @ 2008-08-30  0:08 UTC (permalink / raw)
  To: u-boot

Adds returning an error from the ramdisk detection code if
its not a real ramdisk (invalid).  There is no reason we can't
just return back to the console if we detect an invalid
ramdisk or CRC error.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---

This is based on Anatolij's patch:

'Prevent crash if random DTB address is passed to bootm'

- k

 common/cmd_bootm.c |    2 +-
 common/image.c     |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 374085c..751f5b9 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -246,7 +246,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		ret = boot_get_ramdisk (argc, argv, &images, IH_INITRD_ARCH,
 				&images.rd_start, &images.rd_end);
 		if (ret) {
-			puts ("Ramdisk image is corrupt\n");
+			puts ("Ramdisk image is corrupt or invalid\n");
 			return 1;
 		}
 
diff --git a/common/image.c b/common/image.c
index 0acdcf1..94f01ad 100644
--- a/common/image.c
+++ b/common/image.c
@@ -749,7 +749,7 @@ int genimg_has_config (bootm_headers_t *images)
  *     rd_start and rd_end are set to ramdisk start/end addresses if
  *     ramdisk image is found and valid
  *
- *     1, if ramdisk image is found but corrupted
+ *     1, if ramdisk image is found but corrupted, or invalid
  *     rd_start and rd_end are set to 0 if no ramdisk exists
  */
 int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images,
@@ -936,6 +936,7 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images,
 		default:
 			puts ("Wrong Ramdisk Image Format\n");
 			rd_data = rd_len = rd_load = 0;
+			return 1;
 		}
 
 #if defined(CONFIG_B2) || defined(CONFIG_EVB4510) || defined(CONFIG_ARMADILLO)
-- 
1.5.5.1

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

* [U-Boot] [PATCH] Prevent crash if random/invalid ramdisks are passed to bootm
  2008-08-30  0:08 [U-Boot] [PATCH] Prevent crash if random/invalid ramdisks are passed to bootm Kumar Gala
@ 2008-09-06 22:19 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2008-09-06 22:19 UTC (permalink / raw)
  To: u-boot

Dear Kumar Gala,

In message <1220054909-1627-1-git-send-email-galak@kernel.crashing.org> you wrote:
> Adds returning an error from the ramdisk detection code if
> its not a real ramdisk (invalid).  There is no reason we can't
> just return back to the console if we detect an invalid
> ramdisk or CRC error.
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> 
> This is based on Anatolij's patch:
> 
> 'Prevent crash if random DTB address is passed to bootm'
> 
> - k
> 
>  common/cmd_bootm.c |    2 +-
>  common/image.c     |    3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All this doesn't alter anything, you know. The world is still full of
stupid people. They don't use their brains. They don't seem  to  want
to think straight.                    - Terry Pratchett, _Soul Music_

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

end of thread, other threads:[~2008-09-06 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-30  0:08 [U-Boot] [PATCH] Prevent crash if random/invalid ramdisks are passed to bootm Kumar Gala
2008-09-06 22:19 ` Wolfgang Denk

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