git: e7f84fe6cfac - main - mkimg: Don't ignore invalid partition offsets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Oct 2026 20:48:32 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=e7f84fe6cfac2de3471e4912b1ac82023976ccfa
commit e7f84fe6cfac2de3471e4912b1ac82023976ccfa
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-10-06 21:22:07 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-10-21 19:42:43 +0000
mkimg: Don't ignore invalid partition offsets
When handling PART_KIND_FILE, the "error" variable is set to reflect
any errors in parsing the specified offset; but that value is then
overwritten by the return value of image_copyin.
Error out immediately instead. Note that it is not necessary to change
the code in PART_KIND_SIZE which parses the size, since in that case we
do not overwrite the value in "error".
Fixes: 8f3c71c85e5f ("mkimg: Add support for offset if the source is an image")
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D60422
---
usr.bin/mkimg/mkimg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c
index 9d8c53e262a3..b727b43683a3 100644
--- a/usr.bin/mkimg/mkimg.c
+++ b/usr.bin/mkimg/mkimg.c
@@ -504,7 +504,7 @@ mkimg(void)
else
offset++;
if (expand_number(offset, &byteoffset) == -1)
- error = errno;
+ err(EX_IOERR, "partition %d", part->index + 1);
}
/* Work out exactly where the partition starts. */