diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2011-02-09 13:13:04 +0200 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2011-02-10 08:23:49 +0900 |
commit | dad6f49c3643ece722a784a676434c88f3f1e19d (patch) | |
tree | 97a8a35729b5565da19b20a8704f5a3bf5c3d5a3 | |
parent | c75354b291d1c8cc306d02a63372d487299188b3 (diff) | |
download | kexec-tools-dad6f49c3643ece722a784a676434c88f3f1e19d.tar.gz |
kexec-tools: Don't duplicate the bzImage header area
Don't wholeheartedly copy the 32-Kbytes bzImage header area to the stack,
just use a constant pointer instead.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/i386/kexec-bzImage.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c index 83d3a69e..29e91654 100644 --- a/kexec/arch/i386/kexec-bzImage.c +++ b/kexec/arch/i386/kexec-bzImage.c @@ -43,32 +43,32 @@ static const int probe_debug = 0; int bzImage_probe(const char *buf, off_t len) { - struct x86_linux_header header; + const struct x86_linux_header *header; if ((uintmax_t)len < (uintmax_t)sizeof(header)) { return -1; } - memcpy(&header, buf, sizeof(header)); - if (memcmp(header.header_magic, "HdrS", 4) != 0) { + header = (const struct x86_linux_header *)buf; + if (memcmp(header->header_magic, "HdrS", 4) != 0) { if (probe_debug) { fprintf(stderr, "Not a bzImage\n"); } return -1; } - if (header.boot_sector_magic != 0xAA55) { + if (header->boot_sector_magic != 0xAA55) { if (probe_debug) { fprintf(stderr, "No x86 boot sector present\n"); } /* No x86 boot sector present */ return -1; } - if (header.protocol_version < 0x0200) { + if (header->protocol_version < 0x0200) { if (probe_debug) { fprintf(stderr, "Must be at least protocol version 2.00\n"); } /* Must be at least protocol version 2.00 */ return -1; } - if ((header.loadflags & 1) == 0) { + if ((header->loadflags & 1) == 0) { if (probe_debug) { fprintf(stderr, "zImage not a bzImage\n"); } |