git: 2c2007fa3e65 - main - md: Read the preloaded image length as size_t
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 Nov 2026 09:19:54 UTC
The branch main has been updated by olivier:
URL: https://cgit.FreeBSD.org/src/commit/?id=2c2007fa3e65781f6a201807ecb0daa274b90a19
commit 2c2007fa3e65781f6a201807ecb0daa274b90a19
Author: Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2026-11-12 10:28:01 +0000
Commit: Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2026-11-19 09:14:24 +0000
md: Read the preloaded image length as size_t
hint.md.N.len was read as an int, so on 64-bit platforms ram disks of
4 GiB or more were truncated, or skipped at exact multiples of 4 GiB.
Reported by: llm-postcr
Reviewed by: imp
Approved by: imp
Fixes: 15925062e1ba ("biosboot: Detect memory disks from PXE")
Sponsored by: Netflix
Differential Revision: https://ron-dev.freebsd.org/FreeBSD/src/pulls/104
---
sys/dev/md/md.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index f29490d12b85..0875832d667b 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -2080,7 +2080,7 @@ g_md_init(struct g_class *mp __unused)
caddr_t mod;
u_char *ptr, *name, *type;
u_char scratch[40];
- unsigned len;
+ size_t len;
int i;
vm_offset_t paddr;
@@ -2129,7 +2129,7 @@ g_md_init(struct g_class *mp __unused)
for (int i = 0; i < 32; i++) {
if (resource_long_value("md", i, "physaddr",
(long *) &paddr) != 0 ||
- resource_int_value("md", i, "len", &len) != 0)
+ resource_long_value("md", i, "len", (long *)&len) != 0)
break;
/*
* Map the memory into the kernel pmap, if not already present.