diff options
author | Justus Winter <justus@gnupg.org> | 2017-08-14 19:17:45 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2017-08-14 21:48:40 +0200 |
commit | 5aba22e3c66bb1fa5925e7ce976f436a48ec16b7 (patch) | |
tree | 13d46aa889ca5976c8b86eb726f9e2ef5dc613e7 /vm | |
parent | d2efceefd3ab02fe887b3e0c73e71224a463871c (diff) | |
download | gnumach-5aba22e3c66bb1fa5925e7ce976f436a48ec16b7.tar.gz gnumach-5aba22e3c66bb1fa5925e7ce976f436a48ec16b7.tar.bz2 gnumach-5aba22e3c66bb1fa5925e7ce976f436a48ec16b7.zip |
vm: Improve error handling.
* vm/vm_map.c (vm_map_create): Gracefully handle resource exhaustion.
(vm_map_fork): Likewise at the callsite.
Diffstat (limited to 'vm')
-rw-r--r-- | vm/vm_map.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c index ee443e12..2f687fa3 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -216,7 +216,7 @@ vm_map_t vm_map_create( result = (vm_map_t) kmem_cache_alloc(&vm_map_cache); if (result == VM_MAP_NULL) - panic("vm_map_create"); + return VM_MAP_NULL; vm_map_setup(result, pmap, min, max); @@ -4245,6 +4245,10 @@ vm_map_t vm_map_fork(vm_map_t old_map) new_map = vm_map_create(new_pmap, old_map->min_offset, old_map->max_offset); + if (new_pmap == PMAP_NULL) { + pmap_destroy(new_pmap); + return VM_MAP_NULL; + } for ( old_entry = vm_map_first_entry(old_map); |