diff options
author | Tom Rini | 2020-08-05 16:05:33 -0400 |
---|---|---|
committer | Tom Rini | 2020-08-05 16:05:33 -0400 |
commit | 635dfee2cb522f5072530ca63fd4ab02890b90a2 (patch) | |
tree | 8abedb1958a51367a9a08922eea3d33cfb6035f4 /tools | |
parent | f1c0b7cd4be2081ae3711cec2c4cc2910a5817e1 (diff) | |
parent | 7b27e0fe13d8d44da6cd357a69668a726b852502 (diff) |
Merge branch '2020-08-05-misc-fixes'
- A large number of assorted fixes and minor improvements
Diffstat (limited to 'tools')
-rw-r--r-- | tools/env/fw_env.c | 6 | ||||
-rw-r--r-- | tools/fit_image.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 3ab1ae69c7a..66cb9d2a25e 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -952,8 +952,8 @@ static int flash_read_buf(int dev, int fd, void *buf, size_t count, return -1; } if (rc != readlen) { - fprintf(stderr, "Read error on %s: " - "Attempted to read %d bytes but got %d\n", + fprintf(stderr, + "Read error on %s: Attempted to read %zd bytes but got %d\n", DEVNAME(dev), readlen, rc); return -1; } @@ -995,7 +995,7 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count) of the data */ loff_t blockstart; /* running start of the current block - MEMGETBADBLOCK needs 64 bits */ - int was_locked; /* flash lock flag */ + int was_locked = 0; /* flash lock flag */ int rc; /* diff --git a/tools/fit_image.c b/tools/fit_image.c index df310b53da3..f7d2f560294 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -388,7 +388,7 @@ static int fit_build(struct image_tool_params *params, const char *fname) size = fit_calc_size(params); if (size < 0) return -1; - buf = malloc(size); + buf = calloc(1, size); if (!buf) { fprintf(stderr, "%s: Out of memory (%d bytes)\n", params->cmdname, size); @@ -467,7 +467,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname) * Allocate space to hold the image data we will extract, * extral space allocate for image alignment to prevent overflow. */ - buf = malloc(fit_size + (align_size * image_number)); + buf = calloc(1, fit_size + (align_size * image_number)); if (!buf) { ret = -ENOMEM; goto err_munmap; @@ -572,7 +572,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname) /* Allocate space to hold the new FIT */ size = sbuf.st_size + 16384; - fdt = malloc(size); + fdt = calloc(1, size); if (!fdt) { fprintf(stderr, "%s: Failed to allocate memory (%d bytes)\n", __func__, size); @@ -673,7 +673,7 @@ static int copyfile(const char *src, const char *dst) goto out; } - buf = malloc(512); + buf = calloc(1, 512); if (!buf) { printf("Can't allocate buffer to copy file\n"); goto out; |