From fcccc2df555ee1b5b321a5bd24181c30337b92d4 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 20 Nov 1998 23:57:25 +0000 Subject: careful mmap --- sys/arch/mac68k/dev/asc.c | 4 ++-- sys/arch/mac68k/dev/grf.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arch/mac68k/dev/asc.c b/sys/arch/mac68k/dev/asc.c index e28c325f1d7..5cd6ce22626 100644 --- a/sys/arch/mac68k/dev/asc.c +++ b/sys/arch/mac68k/dev/asc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc.c,v 1.7 1998/04/27 02:04:32 gene Exp $ */ +/* $OpenBSD: asc.c,v 1.8 1998/11/20 23:57:24 deraadt Exp $ */ /* $NetBSD: asc.c,v 1.20 1997/02/24 05:47:33 scottr Exp $ */ /* @@ -281,7 +281,7 @@ ascmmap(dev, off, prot) vm_offset_t pa; sc = asc_cd.cd_devs[unit]; - if (off < MAC68K_ASC_LEN) { + if (off >= 0 && off < MAC68K_ASC_LEN) { pa = pmap_extract(pmap_kernel(), (vm_offset_t)sc->sc_handle); return mac68k_btop(pa + off); } diff --git a/sys/arch/mac68k/dev/grf.c b/sys/arch/mac68k/dev/grf.c index 8e86c877e1f..694423e145d 100644 --- a/sys/arch/mac68k/dev/grf.c +++ b/sys/arch/mac68k/dev/grf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf.c,v 1.7 1997/03/12 13:36:57 briggs Exp $ */ +/* $OpenBSD: grf.c,v 1.8 1998/11/20 23:57:24 deraadt Exp $ */ /* $NetBSD: grf.c,v 1.41 1997/02/24 06:20:04 scottr Exp $ */ /* @@ -331,7 +331,7 @@ grfaddr(gp, off) register struct grfmode *gm = gp->sc_grfmode; u_long addr; - if (off < mac68k_round_page(gm->fbsize + gm->fboff)) { + if (off >= 0 && off < mac68k_round_page(gm->fbsize + gm->fboff)) { addr = (u_long)(*gp->sc_phys)(gp, (vm_offset_t)gm->fbbase)+off; return mac68k_btop(addr); } -- cgit v1.2.3