summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-15 00:23:23 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:41 +0000
commit66a9166004494678feb7ca3974c04801f0b83cb9 (patch)
tree58ee6db1616490224f78830e9852f5ebfc435fd3 /util
parent210f17b9d74ea941f73c9d92f5c636a6fbbcb366 (diff)
util/nvmutil: stricter rw_gbe_file_exact
we repeat these stteps later, but it's still good to be exact here. these lower functions can change. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index a26fa553..1bef8850 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1817,9 +1817,10 @@ rw_gbe_file_exact(int fd, u8 *mem, size_t nrw,
{
size_t mem_addr;
size_t buf_addr;
+ ssize_t r;
- if (mem == NULL)
- goto err_rw_gbe_file_exact;
+ if (io_args(fd, mem, nrw, off, rw_type) == -1)
+ return -1;
mem_addr = (size_t)(void *)mem;
buf_addr = (size_t)(void *)buf;
@@ -1841,10 +1842,12 @@ rw_gbe_file_exact(int fd, u8 *mem, size_t nrw,
if (nrw > (size_t)GBE_PART_SIZE)
goto err_rw_gbe_file_exact;
- return rw_file_exact(fd, mem, nrw, off, rw_type,
+ r = rw_file_exact(fd, mem, nrw, off, rw_type,
NO_LOOP_EAGAIN, LOOP_EINTR, MAX_ZERO_RW_RETRY,
OFF_ERR);
+ return rw_over_nrw(r, nrw);
+
err_rw_gbe_file_exact:
errno = EIO;
return -1;