From 5d3043ce9a141d32df0968c0539c79c4492276f5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 28 Aug 2005 04:50:11 +0000 Subject: [PATCH] Correctly handle vm_map_wire()'s failure. (See also revisions 1.81 and 1.82.) Reviewed by: tegge --- sys/kern/link_elf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index db3de5722981..d2809082bf34 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -742,10 +742,14 @@ link_elf_load_file(linker_class_t cls, const char* filename, /* * Wire down the pages */ - vm_map_wire(kernel_map, + error = vm_map_wire(kernel_map, (vm_offset_t) segbase, (vm_offset_t) segbase + segs[i]->p_memsz, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); + if (error != KERN_SUCCESS) { + error = ENOMEM; + goto out; + } #endif }