diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1999-04-23 05:18:08 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1999-04-23 05:18:08 +0000 |
commit | 13c40529e9023e86fdfd28b8b45ba91128aebc67 (patch) | |
tree | d6d3962bf19835dd9cc43744ca4a5268bbc12da0 | |
parent | a54c82f1145fecbd3bed0a3e580cd173fca09099 (diff) |
mmmmap() bounds check.
-rw-r--r-- | sys/arch/mac68k/mac68k/mem.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/arch/mac68k/mac68k/mem.c b/sys/arch/mac68k/mac68k/mem.c index 8723e20240a..6191e4d943b 100644 --- a/sys/arch/mac68k/mac68k/mem.c +++ b/sys/arch/mac68k/mac68k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.5 1998/08/31 17:42:32 millert Exp $ */ +/* $OpenBSD: mem.c,v 1.6 1999/04/23 05:18:07 downsj Exp $ */ /* $NetBSD: mem.c,v 1.11 1996/05/05 06:18:41 briggs Exp $ */ /* @@ -195,6 +195,11 @@ mmmmap(dev, off, prot) dev_t dev; int off, prot; { + extern int numranges; + extern u_long low[8]; + extern u_long high[8]; + int seg; + /* * /dev/mem is the only one that makes sense through this * interface. For /dev/kmem any physaddr we return here @@ -210,8 +215,10 @@ mmmmap(dev, off, prot) * * XXX could be extended to allow access to IO space but must * be very careful. - if ((unsigned)off < lowram || (unsigned)off >= 0xFFFFFFFC) - return (-1); */ - return (mac68k_btop(off)); + for (seg = 0; seg < numranges; seg++) { + if (((u_long)off >= low[seg]) && ((u_long)off <= high[seg])) + return (mac68k_btop(off)); + } + return (-1); } |