From f0905cd7ec2013d468d2c5d312b84b861e2ad67e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 15 Mar 2026 00:23:23 +0000 Subject: 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 --- util/nvmutil/nvmutil.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'util/nvmutil') 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; -- cgit v1.2.1