From f68cedf202c1fc6c39243136a4d766bc1d67cc80 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 1 Apr 2026 16:11:50 +0100 Subject: libreboot-utils/file: never retry file rw on zero even with a timer, it's possible that on a buggy system, we may keep writing even though the outcome is zero. if a system comes back with zero bytes written, that is a fatal bug and we should stop. Signed-off-by: Leah Rowe --- util/libreboot-utils/lib/io.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'util/libreboot-utils/lib/io.c') diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c index f8e67977..81f9f52a 100644 --- a/util/libreboot-utils/lib/io.c +++ b/util/libreboot-utils/lib/io.c @@ -109,7 +109,7 @@ read_file(void) /* read main file */ _r = rw_file_exact(f->gbe_fd, f->buf, f->gbe_file_size, - 0, IO_PREAD, MAX_ZERO_RW_RETRY); + 0, IO_PREAD); if (_r < 0) exitf("%s: read failed", f->fname); @@ -117,7 +117,7 @@ read_file(void) /* copy to tmpfile */ _r = rw_file_exact(f->tmp_fd, f->buf, f->gbe_file_size, - 0, IO_PWRITE, MAX_ZERO_RW_RETRY); + 0, IO_PWRITE); if (_r < 0) exitf("%s: %s: copy failed", @@ -140,7 +140,7 @@ read_file(void) exitf("%s: fsync (tmpfile copy)", f->tname); _r = rw_file_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size, - 0, IO_PREAD, MAX_ZERO_RW_RETRY); + 0, IO_PREAD); if (_r < 0) exitf("%s: read failed (cmp)", f->tname); @@ -556,8 +556,7 @@ rw_gbe_file_exact(int fd, unsigned char *mem, size_t nrw, if (nrw > (size_t)GBE_PART_SIZE) goto err_rw_gbe_file_exact; - r = rw_file_exact(fd, mem, nrw, off, rw_type, - MAX_ZERO_RW_RETRY); + r = rw_file_exact(fd, mem, nrw, off, rw_type); return rw_over_nrw(r, nrw); -- cgit v1.2.1