diff options
author | 2007-03-05 21:47:55 +0000 | |
---|---|---|
committer | 2007-03-05 21:47:55 +0000 | |
commit | 260c1bd99f29442ee34d31e886843c5396019b6c (patch) | |
tree | 32bb2455c5cc75997baf64a186983dda606d1bc9 | |
parent | Lower the ipl to what it was at the time of the trap in general_exception, (diff) | |
download | wireguard-openbsd-260c1bd99f29442ee34d31e886843c5396019b6c.tar.xz wireguard-openbsd-260c1bd99f29442ee34d31e886843c5396019b6c.zip |
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); } /* |