-/* $OpenBSD: uvm_map.c,v 1.218 2016/07/29 20:44:40 tedu Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.219 2016/07/30 16:43:44 kettenis Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
goto unlock;
}
+ /* Double-check if selected address doesn't cause overflow. */
+ if (*addr + sz < *addr) {
+ error = ENOMEM;
+ goto unlock;
+ }
+
/* If we only want a query, return now. */
if (flags & UVM_FLAG_QUERY) {
error = 0;
goto unlock;
}
+ /* Double-check if selected address doesn't cause overflow. */
+ if (*addr + sz < *addr) {
+ error = ENOMEM;
+ goto unlock;
+ }
+
KASSERT((map->flags & VM_MAP_ISVMSPACE) == VM_MAP_ISVMSPACE ||
uvm_maxkaddr >= *addr + sz);