summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 23:26:54 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-14 23:26:54 +0000
commit4db11cd4ed9520dea4d01e2c1d460789d6ea7c89 (patch)
tree274154a2ba100d2d19ea2f0dba538ccfd21d3ff3 /util
parent9d7e990df46b2f0b1b21509870203fc8c158e940 (diff)
util/nvmutil: rw_over_nrw: err if nrw is zero
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 2e718b23..d9c09bc4 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -2149,6 +2149,14 @@ err_is_file:
static ssize_t
rw_over_nrw(ssize_t r, size_t nrw)
{
+ /*
+ * If a byte length of zero
+ * was requested, that is
+ * clearly a bug. No way.
+ */
+ if (!nrw)
+ goto err_rw_over_nrw;
+
if (r == -1)
return r;