diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2016-07-29 20:44:41 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2016-07-29 20:44:41 +0000 |
commit | a3ddcb4039ce7daad0a0dff8f3361f5c0fa5fd91 (patch) | |
tree | e78e12abbc818fbce1c21d7aed8dddbc1d64386d | |
parent | 4d0cbf4a220cf8d4a55e29cdf395b78de055597d (diff) |
add a check that the arguments to isavail don't overflow.
callers should probably check too, but checking here won't hurt.
possible panic reported by tim newsham.
ok kettenis
-rw-r--r-- | sys/uvm/uvm_map.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 50504646028..254dd4da146 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.217 2016/06/17 10:48:25 dlg Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.218 2016/07/29 20:44:40 tedu Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -771,6 +771,9 @@ uvm_map_isavail(struct vm_map *map, struct uvm_addr_state *uaddr, struct uvm_map_addr *atree; struct vm_map_entry *i, *i_end; + if (addr + sz < addr) + return 0; + /* * Kernel memory above uvm_maxkaddr is considered unavailable. */ |