From: tedu Date: Fri, 29 Jul 2016 20:44:40 +0000 (+0000) Subject: add a check that the arguments to isavail don't overflow. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5e38141c55bce6ceeaf7c96a4314e752c291a198;p=openbsd 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 --- 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. */