aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/src
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-04-08 09:10:20 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-04-08 10:50:59 +0200
commit5a2086d230063b2f83a436ed37b0f6a92706bcb9 (patch)
treea6340a0ccba7d2bd274650637bca5817c83db1c9 /tools/firmware-utils/src
parentdd3c1ad8ee9ee361285cb9142bdcb35bc3a30ac7 (diff)
downloadupstream-5a2086d230063b2f83a436ed37b0f6a92706bcb9.tar.gz
upstream-5a2086d230063b2f83a436ed37b0f6a92706bcb9.tar.bz2
upstream-5a2086d230063b2f83a436ed37b0f6a92706bcb9.zip
firmware-utils: bcm4908img: fix uninitialized var usage
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'tools/firmware-utils/src')
-rw-r--r--tools/firmware-utils/src/bcm4908img.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/firmware-utils/src/bcm4908img.c b/tools/firmware-utils/src/bcm4908img.c
index d97e54e0f6..402d317190 100644
--- a/tools/firmware-utils/src/bcm4908img.c
+++ b/tools/firmware-utils/src/bcm4908img.c
@@ -567,8 +567,8 @@ out:
static int bcm4908img_extract(int argc, char **argv) {
struct bcm4908img_info info;
const char *pathname = NULL;
+ const char *type = NULL;
uint8_t buf[1024];
- const char *type;
size_t offset;
size_t length;
size_t bytes;
@@ -600,7 +600,11 @@ static int bcm4908img_extract(int argc, char **argv) {
goto err_close;
}
- if (!strcmp(type, "cferom")) {
+ if (!type) {
+ err = -EINVAL;
+ fprintf(stderr, "No data to extract specified\n");
+ goto err_close;
+ } else if (!strcmp(type, "cferom")) {
offset = info.cferom_offset;
length = info.bootfs_offset - offset;
if (!length) {
@@ -625,7 +629,7 @@ static int bcm4908img_extract(int argc, char **argv) {
if (!length) {
err = -EINVAL;
- fprintf(stderr, "No data to extract specified\n");
+ fprintf(stderr, "Failed to find requested data in input image\n");
goto err_close;
}