Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt Calculate the minimum address, don't assume the ...



details:   https://anonhg.NetBSD.org/src/rev/8c4c4bed110d
branches:  trunk
changeset: 359459:8c4c4bed110d
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Jan 07 07:25:37 2022 +0000

description:
Calculate the minimum address, don't assume the first entry is the start.

diffstat:

 sys/dev/fdt/fdt_memory.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 6d0414d5507f -r 8c4c4bed110d sys/dev/fdt/fdt_memory.c
--- a/sys/dev/fdt/fdt_memory.c  Fri Jan 07 06:57:57 2022 +0000
+++ b/sys/dev/fdt/fdt_memory.c  Fri Jan 07 07:25:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $ */
+/* $NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "opt_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -90,12 +90,13 @@
             index++) {
                fdt_memory_add_range(cur_addr, cur_size);
 
-               /* Assume the first entry is the start of memory */
                if (index == 0) {
                        *pstart = cur_addr;
                        *pend = cur_addr + cur_size;
                        continue;
                }
+               if (cur_addr < *pstart)
+                       *pstart = cur_addr;
                if (cur_addr + cur_size > *pend)
                        *pend = cur_addr + cur_size;
        }



Home | Main Index | Thread Index | Old Index