Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/m68k check the result value of pmap_extract() ...



details:   https://anonhg.NetBSD.org/src/rev/915f95c1d737
branches:  trunk
changeset: 982522:915f95c1d737
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Apr 16 00:13:48 2021 +0000

description:
check the result value of pmap_extract() and panic if it fails.
this is a "should never fail" case, and GCC 10 noticed that it
allows an uninitialised variable use.

tested by rin@ on amiga and mac68k.

diffstat:

 sys/arch/m68k/m68k/pmap_motorola.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r f74516d46810 -r 915f95c1d737 sys/arch/m68k/m68k/pmap_motorola.c
--- a/sys/arch/m68k/m68k/pmap_motorola.c        Thu Apr 15 19:06:42 2021 +0000
+++ b/sys/arch/m68k/m68k/pmap_motorola.c        Fri Apr 16 00:13:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_motorola.c,v 1.73 2021/02/01 19:02:27 skrll Exp $        */
+/*     $NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.73 2021/02/01 19:02:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1667,7 +1667,11 @@
                 * ST and Sysptmap entries.
                 */
 
-               (void) pmap_extract(pmap, pv->pv_va, &kpa);
+               if (!pmap_extract(pmap, pv->pv_va, &kpa)) {
+                       printf("collect: freeing KPT page at %lx (ste %x@%p)\n",
+                           pv->pv_va, *pv->pv_ptste, pv->pv_ptste);
+                       panic("pmap_collect: mapping not found");
+               }
                pmap_remove_mapping(pmap, pv->pv_va, NULL,
                    PRM_TFLUSH|PRM_CFLUSH, NULL);
 



Home | Main Index | Thread Index | Old Index