summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-04 01:27:13 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-04 01:27:13 +0000
commite28409d80b65da73cd9fa4d5564bdb8cf3b2d991 (patch)
tree315739168e0dfbe486a5e88452a9c13a32230ae9 /util/nvmutil
parent7d6f1a6b30db7956fac1261acb6b742895bf506d (diff)
util/nvmutil: handle error after check_read_or_die
we already exit reliably in that function. the current code is logically correct, but very weak against future changes. this extra check is essentially redundant, but prevantative against future changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index bff8bab0..6cb11d55 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -301,6 +301,8 @@ read_gbe_part(int p, int invert)
if (errno)
err(errno, "Unhandled error on read of file '%s'", fname);
+ if (rval != (ssize_t) SIZE_4KB)
+ err(ECANCELED, "Unknown error on read of file '%s'", fname);
swap(p ^ invert); /* handle big-endian host CPU */
}
@@ -426,6 +428,8 @@ read_urandom(uint8_t *rnum, size_t rsize)
if (errno)
err(errno, "Unhandled error on read of file '/dev/urandom'");
+ if (rval != (ssize_t) rsize)
+ err(ECANCELED, "Unknown error on read of file '/dev/urandom'");
}
static int