From: Marc-Christian Petersen <m.c.p@wolk-project.de>

2.4 patch from Adrian Bunk.

ERRORS

    The mprotect() function shall fail if:

    ...

    [ENOMEM]
        Addresses in the range [addr,addr+len) are invalid for the
        address space of a process, or specify one or more pages which are
        not mapped.


---

 25-akpm/mm/mprotect.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN mm/mprotect.c~mprotect-retval-fix mm/mprotect.c
--- 25/mm/mprotect.c~mprotect-retval-fix	2004-03-21 00:00:57.686890312 -0800
+++ 25-akpm/mm/mprotect.c	2004-03-21 00:00:57.688890008 -0800
@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t
 	len = PAGE_ALIGN(len);
 	end = start + len;
 	if (end < start)
-		return -EINVAL;
+		return -ENOMEM;
 	if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM))
 		return -EINVAL;
 	if (end == start)

_