Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcarm/hpcarm alloc_pages: panic if allocating beyo...



details:   https://anonhg.NetBSD.org/src/rev/334a87b7cf06
branches:  trunk
changeset: 989087:334a87b7cf06
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Oct 11 14:36:05 2021 +0000

description:
alloc_pages: panic if allocating beyond KERNEL_TEXT_BASE.

diffstat:

 sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r db66e2f285ab -r 334a87b7cf06 sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c
--- a/sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c       Mon Oct 11 14:33:31 2021 +0000
+++ b/sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c       Mon Oct 11 14:36:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sa11x0_hpc_machdep.c,v 1.20 2021/10/11 14:33:31 rin Exp $      */
+/*     $NetBSD: sa11x0_hpc_machdep.c,v 1.21 2021/10/11 14:36:05 rin Exp $      */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.20 2021/10/11 14:33:31 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.21 2021/10/11 14:36:05 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_dram_pages.h"
@@ -286,6 +286,8 @@
     do {                                                               \
        (var) = freemempos;                                             \
        freemempos += (np) * PAGE_SIZE;                                 \
+       if (freemempos > KERNEL_TEXT_BASE)                              \
+               panic("%s: out of memory", __func__);                   \
     } while (0)
 
        valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);



Home | Main Index | Thread Index | Old Index