]> git.hungrycats.org Git - linux/commitdiff
[PATCH] mprotect return value fix
authorAndrew Morton <akpm@osdl.org>
Sun, 21 Mar 2004 00:38:39 +0000 (16:38 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 21 Mar 2004 00:38:39 +0000 (16:38 -0800)
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.

mm/mprotect.c

index 31b27771a74c68accd23d95423cbc485bab252fd..24b3d13b51ec30af2326dae082ee52c78e75df70 100644 (file)
@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot)
        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)