mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH for next] 'bootz' command fails to load the zImage's header
@ 2011-10-14 12:11 Juergen Beisert
  2011-10-14 12:16 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Juergen Beisert @ 2011-10-14 12:11 UTC (permalink / raw)
  To: barebox

Running the 'bootz' command always fails with

could not read <some file>

due to it loads only a size of a pointer, instead of the size of the expected
header structure.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
index fc14487..9be615b 100644
--- a/arch/arm/lib/bootz.c
+++ b/arch/arm/lib/bootz.c
@@ -53,7 +53,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
 
 	if (!usemap) {
 		header = &__header;
-		ret = read(fd, header, sizeof(header));
+		ret = read(fd, header, sizeof(*header));
 		if (ret < sizeof(*header)) {
 			printf("could not read %s\n", argv[1]);
 			goto err_out;

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH for next] 'bootz' command fails to load the zImage's header
  2011-10-14 12:11 [PATCH for next] 'bootz' command fails to load the zImage's header Juergen Beisert
@ 2011-10-14 12:16 ` Sascha Hauer
  2011-10-14 12:37   ` [PATCH for master] Really fix the 'bootz' command Juergen Beisert
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2011-10-14 12:16 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

On Fri, Oct 14, 2011 at 02:11:28PM +0200, Juergen Beisert wrote:
> Running the 'bootz' command always fails with
> 
> could not read <some file>
> 
> due to it loads only a size of a pointer, instead of the size of the expected
> header structure.

Applied to master instead which also has this bug. Unfortunately this
bug is also in the october release.

Sascha

> 
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> 
> diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
> index fc14487..9be615b 100644
> --- a/arch/arm/lib/bootz.c
> +++ b/arch/arm/lib/bootz.c
> @@ -53,7 +53,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
>  
>  	if (!usemap) {
>  		header = &__header;
> -		ret = read(fd, header, sizeof(header));
> +		ret = read(fd, header, sizeof(*header));
>  		if (ret < sizeof(*header)) {
>  			printf("could not read %s\n", argv[1]);
>  			goto err_out;
> 
> -- 
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH for master] Really fix the 'bootz' command
  2011-10-14 12:16 ` Sascha Hauer
@ 2011-10-14 12:37   ` Juergen Beisert
  0 siblings, 0 replies; 3+ messages in thread
From: Juergen Beisert @ 2011-10-14 12:37 UTC (permalink / raw)
  To: barebox

Running the 'bootz' command always fails with

could not read <some file>

due to wrong usage of pointers and structures. This is the second try to fix
the 'bootz' command. At least on my target it is now be able again to load a
kernel without any error.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
index 9be615b..956ea82 100644
--- a/arch/arm/lib/bootz.c
+++ b/arch/arm/lib/bootz.c
@@ -89,10 +89,10 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
 			}
 		}
 
-		memcpy(zimage, &header, sizeof(header));
+		memcpy(zimage, header, sizeof(*header));
 
-		ret = read(fd, zimage + sizeof(header), end - sizeof(header));
-		if (ret < end - sizeof(header)) {
+		ret = read(fd, zimage + sizeof(*header), end - sizeof(*header));
+		if (ret < end - sizeof(*header)) {
 			printf("could not read %s\n", argv[1]);
 			goto err_out1;
 		}

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2011-10-14 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-14 12:11 [PATCH for next] 'bootz' command fails to load the zImage's header Juergen Beisert
2011-10-14 12:16 ` Sascha Hauer
2011-10-14 12:37   ` [PATCH for master] Really fix the 'bootz' command Juergen Beisert

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