Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2025 08:24:08 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4e3a6fe0134e - main - Make sure the memory region definitions are zeroed before use.
Message-ID:  <202505010824.5418O81E079833@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e3a6fe0134e67fdcd1279b06427e5f26dd08f78

commit 4e3a6fe0134e67fdcd1279b06427e5f26dd08f78
Author:     Luiz Otavio O Souza <loos@FreeBSD.org>
AuthorDate: 2025-04-26 15:23:27 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-05-01 08:23:38 +0000

    Make sure the memory region definitions are zeroed before use.
    
    Since only 32bits of the values are read from the fdt, the existing values
    can compromise the results.
    
    Fixes the boot on the Netgate 3100.
    
    Reviewed by:    andrew, mmel
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D50083
---
 sys/dev/fdt/fdt_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c
index 53d47c26b53d..1fea4c6f1392 100644
--- a/sys/dev/fdt/fdt_common.c
+++ b/sys/dev/fdt/fdt_common.c
@@ -441,6 +441,7 @@ fdt_foreach_reserved_region(fdt_mem_region_cb cb, void *arg)
 	reservep = (pcell_t *)&reserve;
 	for (i = 0; i < tuples; i++) {
 
+		memset(&mr, 0, sizeof(mr));
 		rv = fdt_data_to_res(reservep, addr_cells, size_cells,
 			(u_long *)&mr.mr_start, (u_long *)&mr.mr_size);
 
@@ -484,6 +485,7 @@ fdt_foreach_reserved_mem(fdt_mem_region_cb cb, void *arg)
 			/* XXX: Does a no-map of a dynamic range make sense? */
 			continue;
 
+		memset(&mr, 0, sizeof(mr));
 		fdt_data_to_res(reg, addr_cells, size_cells,
 		    (u_long *)&mr.mr_start, (u_long *)&mr.mr_size);
 
@@ -526,6 +528,7 @@ fdt_foreach_mem_region(fdt_mem_region_cb cb, void *arg)
 	regp = (pcell_t *)&reg;
 	for (i = 0; i < tuples; i++) {
 
+		memset(&mr, 0, sizeof(mr));
 		rv = fdt_data_to_res(regp, addr_cells, size_cells,
 			(u_long *)&mr.mr_start, (u_long *)&mr.mr_size);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505010824.5418O81E079833>