Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Don't pass a block of size 0 to fdt_memory_add_r...



details:   https://anonhg.NetBSD.org/src/rev/3ec0c8f65320
branches:  trunk
changeset: 368786:3ec0c8f65320
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu Aug 04 11:58:55 2022 +0000

description:
Don't pass a block of size 0 to fdt_memory_add_range().

There are some environments where size 0 blocks are passed from the loader.

diffstat:

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

diffs (27 lines):

diff -r f15b9db04c4a -r 3ec0c8f65320 sys/dev/fdt/fdt_memory.c
--- a/sys/dev/fdt/fdt_memory.c  Thu Aug 04 09:02:29 2022 +0000
+++ b/sys/dev/fdt/fdt_memory.c  Thu Aug 04 11:58:55 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $ */
+/* $NetBSD: fdt_memory.c,v 1.5 2022/08/04 11:58:55 ryo 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.4 2022/01/07 07:25:37 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.5 2022/08/04 11:58:55 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -88,6 +88,8 @@
        for (index = 0;
             fdtbus_get_reg64(memory, index, &cur_addr, &cur_size) == 0;
             index++) {
+               if (cur_size == 0)
+                       continue;
                fdt_memory_add_range(cur_addr, cur_size);
 
                if (index == 0) {



Home | Main Index | Thread Index | Old Index