Attention is currently required from: David Hendricks, Jacob Garber.

Nico Huber would like build bot (Jenkins), David Hendricks and Jacob Garber to review this change.

View Change

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>
---
M dummyflasher.c
1 file changed, 23 insertions(+), 2 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/49/67849/1
diff --git a/dummyflasher.c b/dummyflasher.c
index 53801d9..3964226 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -378,8 +378,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 67849. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: 1.1.x
Gerrit-Change-Id: Icd1a72f9171e547f2081ba4bc53834a17ef7fcab
Gerrit-Change-Number: 67849
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: David Hendricks <david.hendricks@gmail.com>
Gerrit-Reviewer: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: David Hendricks <david.hendricks@gmail.com>
Gerrit-Attention: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-MessageType: newchange