1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

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/+/67849
Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
Jacob Garber 2019-08-12 10:44:17 -06:00 committed by Felix Singer
parent ee65a0357e
commit d43c299ca8

View File

@ -378,8 +378,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");
}