diff options
author | Jacob Garber <jgarber1@ualberta.ca> | 2019-08-12 10:44:17 -0600 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2022-09-29 17:03:45 +0000 |
commit | e72d766caf3924fe5e5d00927ac0ed90d3a76d9a (patch) | |
tree | 24ccb628b89996ed24a8fc29405bd9b6b2ab2732 | |
parent | a7d077cb193bdc60d1ce75940476c416f33d46ad (diff) | |
download | flashrom-e72d766caf3924fe5e5d00927ac0ed90d3a76d9a.tar.gz flashrom-e72d766caf3924fe5e5d00927ac0ed90d3a76d9a.tar.bz2 flashrom-e72d766caf3924fe5e5d00927ac0ed90d3a76d9a.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>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67839
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r-- | dummyflasher.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dummyflasher.c b/dummyflasher.c index f1711282d..8c3606e42 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -381,8 +381,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"); } |