summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-13 06:05:54 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-13 06:05:54 +0000
commitebac61df5e6c7c88ad574dc77382288cd8862894 (patch)
treebafa79b4634b964f8d2bf9fc424406e01f2ada47 /util/nvmutil
parentcbf409d6e1b929e5bfd9b835c310b76c92521270 (diff)
util/nvmutil: err in rw_file_exact on zero return
zero never occurs, because rw_file_once never returns zero, but only rw_file_once determines that. rw_file_exact must handle every possible error. right now, if that call returns zero, rw_file_exact would have an infinite loop. this doesn't actually happen at the moment, so this is a preventative bug fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 811cce31..5ee877eb 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1565,7 +1565,7 @@ rw_file_exact(int fd, uint8_t *mem, size_t len,
}
for (rc = 0, rv = 0; rc < len; ) {
- if ((rv = rw_file_once(fd, mem, len, off, rw_type, rc)) == -1)
+ if ((rv = rw_file_once(fd, mem, len, off, rw_type, rc)) <= 0)
return -1;
rc += (size_t)rv;