mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH for master] Really fix the 'bootz' command
Date: Fri, 14 Oct 2011 14:37:56 +0200	[thread overview]
Message-ID: <201110141437.57075.jbe@pengutronix.de> (raw)
In-Reply-To: <20111014121652.GG13898@pengutronix.de>

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

      reply	other threads:[~2011-10-14 12:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Juergen Beisert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110141437.57075.jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox