Skip to contentSkip to conversation

IA-32 support patch: mmap should return ENOMEM

PATCH Applied Arun Sharma 2 participants 2 messages Jun 24, 2003 – Jun 30, 2003

lore
Share & tools
lore
#0 lore raw

Single Unix Specification says:
[ENOMEM] MAP_FIXED was specified, and the range [addr, addr + len) exceeds that allowed for the address space of a process.

Therefore if addr + len > IA32_PAGE_OFFSET, we should return ENOMEM.

Please apply to both 2.4 and 2.5.

-Arun

arch/ia64/ia32/sys_ia32.c renamed from arch/ia64/ia32/sys_ia32.c- +5 -0
@@ -448,7 +448,12 @@
 		return addr;
 
 	if (len > IA32_PAGE_OFFSET || addr > IA32_PAGE_OFFSET - len)
+	{
+		if (flags & MAP_FIXED)
+			return -ENOMEM;
+		else
 		return -EINVAL;
+	}
 
 	if (OFFSET4K(offset))
 		return -EINVAL;
#1 lore raw
Quoted 7 lines · Arun Sharma

Single Unix Specification says:
[ENOMEM] MAP_FIXED was specified, and the range [addr, addr + len) exceeds that allowed for the address space of a process.

Therefore if addr + len > IA32_PAGE_OFFSET, we should return ENOMEM.

Please apply to both 2.4 and 2.5.

Applied to 2.4 (and David put it in 2.5 as well).