Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46667 )
Change subject: ectool: Don't ignore fgets return code ......................................................................
ectool: Don't ignore fgets return code
Change-Id: I12dc449e06dee31b4b0811ab23c6e8635cf31512 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/46667 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com --- M util/ectool/ec.c 1 file changed, 4 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/util/ectool/ec.c b/util/ectool/ec.c index f30d12f..a189a09 100644 --- a/util/ectool/ec.c +++ b/util/ectool/ec.c @@ -167,7 +167,10 @@ return -1;
while (!feof(fp) && (data == 0 || cmd == 0)) { - fgets(line, sizeof(line), fp); + if (fgets(line, sizeof(line), fp) == NULL) { + fprintf(stderr, "Can not read from /proc/ioports.\n"); + break; + } if (strstr(line, "EC data") != NULL) data = strtol(line, NULL, 16);