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.
This commit is contained in:
ryo 2022-08-04 11:58:55 +00:00
parent e603605e86
commit c7071a7006
1 changed files with 4 additions and 2 deletions

View File

@ -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 @@ fdt_memory_get(uint64_t *pstart, uint64_t *pend)
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) {