From 418015c232283820cded6da24accd384bee1f5e5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 3 Mar 2026 20:24:26 +0000 Subject: util/nvmutil: stricter check_bound word/set_word are only meant to operate on the nvm area (128 bytes), but the current check is against the entire 4KB block. swap() only handles the nvm area, as per the design of nvmutil. this patch makes the boundary check truer to my real intent, guarding against future logical errors. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 1c044a19..c5a86c98 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -510,7 +510,7 @@ check_bound(int c, int p) { if ((p != 0) && (p != 1)) err(EINVAL, "check_bound: invalid partnum %d", p); - if ((c < 0) || (c >= (SIZE_4KB >> 1))) + if ((c < 0) || (c >= (NVM_SIZE >> 1))) err(EINVAL, "check_bound: out of bounds %d", c); } -- cgit v1.2.1