summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-13 13:12:51 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:41 +0000
commit435b67327ed73720aa47f2bd23dedd7eb9aada38 (patch)
tree059d542f089741e52896918721f14d32f5eb93a9 /util/nvmutil/nvmutil.c
parent54536b045432e8c78afb264e7b3fed7c6d4487c1 (diff)
util/nvmutil: r_type check in rw_gbe_file_part
i already send the right arg anyway. this is a preventative bug fix against future maintenance. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index da6336aa..8f20c012 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -1456,7 +1456,11 @@ rw_gbe_file_part(size_t p, int rw_type,
uint8_t *mem_offset;
- if (rw_type == IO_WRITE || rw_type == IO_PWRITE)
+ if (rw_type < IO_PREAD || rw_type > IO_PWRITE)
+ err(errno, "%s: %s: part %lu: invalid rw_type, %d",
+ fname, rw_type_str, (unsigned long)p, rw_type);
+
+ if (rw_type == IO_PWRITE)
invert = 0;
/*