diff options
author | Simon Horman <horms@verge.net.au> | 2011-09-06 07:10:08 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2011-09-06 07:12:55 +0900 |
commit | 0ee3b4c136ccf7e9b66f2610a6d7f3ac4c135d14 (patch) | |
tree | 2c3d71930316b53094b742428fd4902e21d7c643 /kexec/kexec-uImage.c | |
parent | fd3178774930cb55f9e9aa6553889e9d54b4500d (diff) |
Use unsigned char buffers in uImage loader
This avoids out of range comparisons (for values >= 128)
and an unnecessary cast.
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec-uImage.c')
-rw-r--r-- | kexec/kexec-uImage.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c index 4ce0f38..409e516 100644 --- a/kexec/kexec-uImage.c +++ b/kexec/kexec-uImage.c @@ -16,7 +16,7 @@ * Basic uImage loader. Not rocket science. */ -int uImage_probe(const char *buf, off_t len, unsigned int arch) +int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch) { struct image_header header; #ifdef HAVE_LIBZ @@ -92,7 +92,7 @@ int uImage_probe(const char *buf, off_t len, unsigned int arch) #define COMMENT 0x10 /* bit 4 set: file comment present */ #define RESERVED 0xE0 /* bits 5..7: reserved */ -static int uImage_gz_load(const char *buf, off_t len, +static int uImage_gz_load(const unsigned char *buf, off_t len, struct Image_info *image) { int ret; @@ -176,7 +176,7 @@ static int uImage_gz_load(const char *buf, off_t len, } while (1); inflateEnd(&strm); - image->buf = (char *)uncomp_buf; + image->buf = uncomp_buf; image->len = mem_alloc - strm.avail_out; return 0; } @@ -188,10 +188,10 @@ static int uImage_gz_load(const char *UNUSED(buf), off_t UNUSED(len), } #endif -int uImage_load(const char *buf, off_t len, struct Image_info *image) +int uImage_load(const unsigned char *buf, off_t len, struct Image_info *image) { const struct image_header *header = (const struct image_header *)buf; - const char *img_buf = buf + sizeof(struct image_header); + const unsigned char *img_buf = buf + sizeof(struct image_header); off_t img_len = len - sizeof(struct image_header); image->base = cpu_to_be32(header->ih_load); |