Felix Singer submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Angel Pons: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved
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>
---
M dummyflasher.c
1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/dummyflasher.c b/dummyflasher.c
index f171128..8c3606e 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -381,8 +381,12 @@
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");
}

To view, visit change 67839. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-Change-Id: Icd1a72f9171e547f2081ba4bc53834a17ef7fcab
Gerrit-Change-Number: 67839
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: David Hendricks <david.hendricks@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged