diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-03-05 21:47:56 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-03-05 21:47:56 +0000 |
commit | bfd82ada45bbaa1265b4a6714224e7e0d6f01b60 (patch) | |
tree | 2cbb7f89619d2e7af6b934cdeeeaa4e14d22828d | |
parent | e75c4998288450dd1b5d34f9f77a541d29709de5 (diff) |
Prevent a NULL pointer dereference in __pmap_kptp_lookup(); from NetBSD
-rw-r--r-- | sys/arch/sh/sh/pmap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/arch/sh/sh/pmap.c b/sys/arch/sh/sh/pmap.c index a849ff41b0d..d6ed6fbb750 100644 --- a/sys/arch/sh/sh/pmap.c +++ b/sys/arch/sh/sh/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.4 2007/03/05 21:39:22 drahn Exp $ */ +/* $OpenBSD: pmap.c,v 1.5 2007/03/05 21:47:55 miod Exp $ */ /* $NetBSD: pmap.c,v 1.55 2006/08/07 23:19:36 tsutsui Exp $ */ /*- @@ -964,9 +964,11 @@ __pmap_pte_lookup(pmap_t pmap, vaddr_t va) pt_entry_t * __pmap_kpte_lookup(vaddr_t va) { - return (__pmap_kernel.pm_ptp - [__PMAP_PTP_INDEX(va - VM_MIN_KERNEL_ADDRESS)] + - __PMAP_PTP_OFSET(va)); + pt_entry_t *ptp; + + ptp = + __pmap_kernel.pm_ptp[__PMAP_PTP_INDEX(va - VM_MIN_KERNEL_ADDRESS)]; + return (ptp ? ptp + __PMAP_PTP_OFSET(va) : NULL); } /* |