]> git.sur5r.net Git - u-boot/commitdiff
sandbox: Correct compiler warnings in cmd_bootm/cmd_ximg
authorSimon Glass <sjg@chromium.org>
Fri, 30 Aug 2013 17:00:09 +0000 (11:00 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 3 Sep 2013 19:29:24 +0000 (13:29 -0600)
Correct the following warnings found with sandbox when compression
is enabled.

cmd_bootm.c: In function 'bootm_load_os':
cmd_bootm.c:443:11: warning: passing argument 4 of 'lzop_decompress' from incompatible pointer type [enabled by default]
/usr/local/google/c/cosarm/src/third_party/u-boot/files/include/linux/lzo.h:31:5: note: expected 'size_t *' but argument is of type 'uint *'
cmd_ximg.c: In function 'do_imgextract':
cmd_ximg.c:225:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_ximg.c:225:14: warning: 'hdr' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
common/cmd_bootm.c
common/cmd_ximg.c

index 1685c14a5261eba30d21ea29c9eb87a65fbe50e5..2dd264272f9585920b1c6677e6e2391142f47dae 100644 (file)
@@ -436,11 +436,12 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
        }
 #endif /* CONFIG_LZMA */
 #ifdef CONFIG_LZO
-       case IH_COMP_LZO:
+       case IH_COMP_LZO: {
+               size_t size;
+
                printf("   Uncompressing %s ... ", type_name);
 
-               ret = lzop_decompress(image_buf, image_len, load_buf,
-                                     &unc_len);
+               ret = lzop_decompress(image_buf, image_len, load_buf, &size);
                if (ret != LZO_E_OK) {
                        printf("LZO: uncompress or overwrite error %d "
                              "- must RESET board to recover\n", ret);
@@ -449,8 +450,9 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
                        return BOOTM_ERR_RESET;
                }
 
-               *load_end = load + unc_len;
+               *load_end = load + size;
                break;
+       }
 #endif /* CONFIG_LZO */
        default:
                printf("Unimplemented compression type %d\n", comp);
index b439be3d088526eb48c0fb9c95cd6f805203728f..65a8319662f13a18450f9c03a77b885590ee45ff 100644 (file)
@@ -20,6 +20,7 @@
 #include <bzlib.h>
 #endif
 #include <asm/byteorder.h>
+#include <asm/io.h>
 
 #ifndef CONFIG_SYS_XIMG_LEN
 /* use 8MByte as default max gunzip size */
@@ -34,7 +35,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        ulong           data, len, count;
        int             verify;
        int             part = 0;
-       image_header_t  *hdr;
+       image_header_t  *hdr = NULL;
 #if defined(CONFIG_FIT)
        const char      *uname = NULL;
        const void*     fit_hdr;
@@ -222,7 +223,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                                 * which requires at most 2300 KB of memory.
                                 */
                                i = BZ2_bzBuffToBuffDecompress(
-                                       (char *)ntohl(hdr->ih_load),
+                                       map_sysmem(ntohl(hdr->ih_load), 0),
                                        &unc_len, (char *)data, len,
                                        CONFIG_SYS_MALLOC_LEN < (4096 * 1024),
                                        0);