firmware-utils: bcm4908img: fix uninitialized var usage

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
Rafał Miłecki 2021-04-08 09:10:20 +02:00
parent dd3c1ad8ee
commit 5a2086d230
1 changed files with 7 additions and 3 deletions

View File

@ -567,8 +567,8 @@ out:
static int bcm4908img_extract(int argc, char **argv) { static int bcm4908img_extract(int argc, char **argv) {
struct bcm4908img_info info; struct bcm4908img_info info;
const char *pathname = NULL; const char *pathname = NULL;
const char *type = NULL;
uint8_t buf[1024]; uint8_t buf[1024];
const char *type;
size_t offset; size_t offset;
size_t length; size_t length;
size_t bytes; size_t bytes;
@ -600,7 +600,11 @@ static int bcm4908img_extract(int argc, char **argv) {
goto err_close; 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; offset = info.cferom_offset;
length = info.bootfs_offset - offset; length = info.bootfs_offset - offset;
if (!length) { if (!length) {
@ -625,7 +629,7 @@ static int bcm4908img_extract(int argc, char **argv) {
if (!length) { if (!length) {
err = -EINVAL; err = -EINVAL;
fprintf(stderr, "No data to extract specified\n"); fprintf(stderr, "Failed to find requested data in input image\n");
goto err_close; goto err_close;
} }