summaryrefslogtreecommitdiff
path: root/util/broadcom/secimage/io.c
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-12-15 14:53:23 +0100
committerPatrick Georgi <pgeorgi@google.com>2016-12-16 18:22:43 +0100
commitca80196ae21fcd5e305e9f0e4d12fdb3a78ab7be (patch)
tree7a5d06a8bdd787cce415a6c0f70f68b7759b89ab /util/broadcom/secimage/io.c
parent2d140212794ba1c773d2a5f36e19617530ab26de (diff)
util/broadcom: Check for successful file access
Change-Id: I5c77b3c5ea3fbc249a8c564a521c2c3c45e1c560 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Found-by: Coverity Scan #1323510 Reviewed-on: https://review.coreboot.org/17877 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/broadcom/secimage/io.c')
-rw-r--r--util/broadcom/secimage/io.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/broadcom/secimage/io.c b/util/broadcom/secimage/io.c
index d71065c9c4..f5be50afc7 100644
--- a/util/broadcom/secimage/io.c
+++ b/util/broadcom/secimage/io.c
@@ -73,6 +73,11 @@ int DataRead(char *filename, uint8_t *buf, int *length)
return -1;
}
len = FileSizeGet(file);
+ if (len < 0) {
+ printf("Unable to seek in file: %s\n", filename);
+ fclose(file);
+ return -1;
+ }
if (len < *length)
*length = len;
else