diff options
author | Jacob Garber <jgarber1@ualberta.ca> | 2019-08-12 10:44:17 -0600 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2019-09-24 19:12:51 +0000 |
commit | ca598dabc3e658b3b80fd41143417d884d436e06 (patch) | |
tree | 9404e4002f46fb82bd9db759422274a06830fb31 | |
parent | 1c0c8fd9da34d29d549803f3ddff9a68dd95dfed (diff) | |
download | flashrom-ca598dabc3e658b3b80fd41143417d884d436e06.tar.gz flashrom-ca598dabc3e658b3b80fd41143417d884d436e06.tar.bz2 flashrom-ca598dabc3e658b3b80fd41143417d884d436e06.zip |
dummyflasher: Add error check for file read
Print an error message and return if the read from emu_persistent_image
fails.
Change-Id: Icd1a72f9171e547f2081ba4bc53834a17ef7fcab
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1403912
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34845
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
-rw-r--r-- | dummyflasher.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dummyflasher.c b/dummyflasher.c index 0caffc9f..2d7fa858 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -390,8 +390,12 @@ int dummy_init(void) if (image_stat.st_size == emu_chip_size) { msg_pdbg("matches.\n"); msg_pdbg("Reading %s\n", emu_persistent_image); - read_buf_from_file(flashchip_contents, emu_chip_size, - emu_persistent_image); + if (read_buf_from_file(flashchip_contents, emu_chip_size, + emu_persistent_image)) { + msg_perr("Unable to read %s\n", emu_persistent_image); + free(flashchip_contents); + return 1; + } } else { msg_pdbg("doesn't match.\n"); } |