diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-03 20:38:36 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-03 20:38:36 +0000 |
| commit | 493e3cf0697ddedb7cf576a92ba890315356a46a (patch) | |
| tree | 9a2fbf503ea96cb0e6a1699489cac084d36bec27 /util/nvmutil | |
| parent | af5d876bf03214b1b7cb84fb261fb00f993719b5 (diff) | |
util/nvmutil: explicitly cast on read/pread/pwrite
these functions return ssize_t, so compare explicitly
to that, when using the SIZE_4KB define for example.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index c0089279..fb25af73 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -242,7 +242,7 @@ static void read_gbe_part(int p, int invert) { if (pread(fd, buf + (SIZE_4KB * (p ^ invert)), SIZE_4KB, p * partsize) - != SIZE_4KB) + != (ssize_t) SIZE_4KB) err(ECANCELED, "Can't read %d b from '%s' p%d", SIZE_4KB, fname, p); swap(p ^ invert); /* handle big-endian host CPU */ @@ -350,7 +350,7 @@ rhex(void) if (!n) { n = sizeof(rnum) - 1; if (read(rfd, (uint8_t *) &rnum, sizeof(rnum)) - != sizeof(rnum)) + != (ssize_t) (sizeof(rnum))) err(ECANCELED, "Could not read from /dev/urandom"); } @@ -534,7 +534,7 @@ write_gbe_part(int p) swap(p); /* swap bytes on big-endian host CPUs */ if (pwrite(fd, buf + (SIZE_4KB * p), - SIZE_4KB, p * partsize) != SIZE_4KB) { + SIZE_4KB, p * partsize) != (ssize_t) SIZE_4KB) { err(ECANCELED, "Can't write %d b to '%s' p%d", SIZE_4KB, fname, p); } |
