diff options
author | Helmut Schaa <helmut.schaa@googlemail.com> | 2012-04-20 11:58:16 +0200 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2012-04-23 14:18:55 +0900 |
commit | 9a41237c258904f3f71a5aec0147d85ffb57d5b6 (patch) | |
tree | 532f8640536558814a6a06d5a24862d99474f552 | |
parent | f7b93e8d0ff5d9bb3d9581f7348218b1a94f9e5c (diff) | |
download | kexec-tools-9a41237c258904f3f71a5aec0147d85ffb57d5b6.tar.gz |
kexec-tools: Fix CRC calculation for padded uImage
Instead of calulating the CRC on the whole file just calculate the CRC
on the actual uImage length as given by the uImage header. This fixes
loading padded uImages, for example from a mtd partition.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
-rw-r--r-- | kexec/kexec-uImage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c index 409e516d..83e7910b 100644 --- a/kexec/kexec-uImage.c +++ b/kexec/kexec-uImage.c @@ -72,7 +72,7 @@ int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch) return -1; } #ifdef HAVE_LIBZ - crc = crc32(0, (void *)buf + sizeof(header), len - sizeof(header)); + crc = crc32(0, (void *)buf + sizeof(header), be32_to_cpu(header.ih_size)); if (crc != be32_to_cpu(header.ih_dcrc)) { printf("The data CRC does not match. Computed: %08x " "expected %08x\n", crc, |