summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 23:10:20 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-14 23:15:14 +0000
commit0e7ac43f289a8d2d163e03657e2f9d20ae64c625 (patch)
tree1853312b83afa67a908e431839317eea50fbd6d1 /util
parent7c79db20e3e8667a26be691e5bcb7d5fb1737e27 (diff)
util/nvmutil: rw_file_exact: explicit casts
don't do it inside functions. some compilers may be inconsistent, ditto several auditing tools. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index ee17b2f7..6a7d96db 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1880,6 +1880,9 @@ rw_file_exact(int fd, u8 *mem, size_t nrw,
ssize_t rv = 0;
ssize_t rc = 0;
size_t retries_on_zero = 0;
+ off_t off_cur;
+ size_t nrw_cur;
+ void *mem_cur;
while (1) {
@@ -1891,10 +1894,11 @@ rw_file_exact(int fd, u8 *mem, size_t nrw,
if ((size_t)rc >= nrw)
break;
- rv = prw(fd,
- mem + (size_t)rc,
- nrw - (size_t)rc,
- (size_t)off + rc,
+ mem_cur = (void *)(mem + (size_t)rc);
+ nrw_cur = (size_t)(nrw - (size_t)rc);
+ off_cur = (off_t)((size_t)off + (size_t)rc);
+
+ rv = prw(fd, mem_cur, nrw_cur, off_cur,
rw_type, loop_eagain, loop_eintr,
OFF_ERR);