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 <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-03 20:24:26 +00:00
parent 80a5b08090
commit 418015c232
+1 -1
View File
@@ -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);
}