git: d866370b80bc - main - loader: efi: fix error check on fstat() in chain
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Nov 2026 04:02:29 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=d866370b80bccb3457fa6e80e940dba0606156c4
commit d866370b80bccb3457fa6e80e940dba0606156c4
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-11-26 04:00:54 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-11-26 04:01:03 +0000
loader: efi: fix error check on fstat() in chain
fstat() returns -1 on failure, so testing for a return value less than
-1 could never catch an error, and we would carry on with whatever
garbage was in the stat buffer.
Reviewed by: imp, sjg, tsoome
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D61846
---
stand/efi/loader/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index dc2f52d525cd..80f5b3c54c1c 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -2049,7 +2049,7 @@ command_chain(int argc, char *argv[])
}
#endif
- if (fstat(fd, &st) < -1) {
+ if (fstat(fd, &st) < 0) {
command_errmsg = "stat failed";
close(fd);
return (CMD_ERROR);