From 668dec36e91f2b35660767a20da07e8fbf123087 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 3 Mar 2026 19:00:14 +0000 Subject: util/nvmutil rhex: check against sizeof(rnum) checking against -1 is incorrect, because we specifically want to ensure that it always read the number of bytes defined by the size of rnum. this still covers the case where the return value is -1, and therefore makes the error handling much stricter. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index ee4ba0d2..9a28cf4f 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -368,7 +368,7 @@ rhex(void) if (!n) { n = sizeof(rnum) - 1; - err_if(read(rfd, (uint8_t *) &rnum, n + 1) == -1); + err_if(read(rfd, (uint8_t *) &rnum, n + 1) != sizeof(rnum)); } return rnum[n--] & 0xf; -- cgit v1.2.1