public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite.dk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tools: default image: use ih_size for checking data size
Date: Tue, 07 May 2013 17:16:24 +0200	[thread overview]
Message-ID: <87d2t2252v.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1367581025-26740-1-git-send-email-jogo@openwrt.org> (Jonas Gorski's message of "Fri, 3 May 2013 13:37:05 +0200")

>>>>> "Jonas" == Jonas Gorski <jogo@openwrt.org> writes:

 Jonas> Common image usage is uImage + appended rootfs, so the the uImage data
 Jonas> is only part of the total image. So read out and use the header's
 Jonas> ih_size field instead of the total file size.

 Jonas> To prevent reading over the end of the buffer, check that the image file
 Jonas> is big enough to contain the data before calculating its checksum.

 Jonas> Before:
 Jonas> ~# mkimage -l dir665_fw_100NA.bin
 Jonas> mkimage: ERROR: "dir665_fw_100NA/dir665_fw_100NA.bin" has corrupted data!

A related usecase is checking the version info of whatever is written to
flash - E.G.

mkimage -l /dev/mtdN

But that already fails as stat returns st_size=0 for devices.

-- 
Bye, Peter Korsgaard

      parent reply	other threads:[~2013-05-07 15:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 11:37 [U-Boot] [PATCH] tools: default image: use ih_size for checking data size Jonas Gorski
2013-05-03 15:04 ` Wolfgang Denk
2013-05-03 15:42   ` Jonas Gorski
2013-05-03 15:54     ` Wolfgang Denk
2013-05-03 16:31       ` Jonas Gorski
2013-05-03 19:13         ` Wolfgang Denk
2013-05-07 15:16 ` Peter Korsgaard [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=87d2t2252v.fsf@dell.be.48ers.dk \
    --to=jacmet@sunsite.dk \
    --cc=u-boot@lists.denx.de \
    /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