[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e94e46a1-d852-f5df-352c-592d5e0e9c6a@gmail.com>
Date: Sun, 17 Nov 2019 19:01:18 +0100
From: "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To: Christian Brauner <christian@...uner.io>
Cc: mtk.manpages@...il.com, adrian@...as.de, akpm@...ux-foundation.org,
arnd@...db.de, avagin@...il.com, christian.brauner@...ntu.com,
dhowells@...hat.com, fweimer@...hat.com, jannh@...gle.com,
keescook@...omium.org, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-man@...r.kernel.org,
mingo@...e.hu, oleg@...hat.com, xemul@...tuozzo.com
Subject: Re: [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap()
On 11/16/19 12:41 PM, Christian Brauner wrote:
> From: Christian Brauner <christian.brauner@...ntu.com>
>
> If mmap() fails it will return MAP_FAILED which according to the manpage
> is (void *)-1 not NULL.
Sigh! Bad editing on my part.
Thanks, Christian.
Patch applied.
Cheers,
Michael
> Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
> ---
> man2/clone.2 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man2/clone.2 b/man2/clone.2
> index 57a9eaba7..faff2ada6 100644
> --- a/man2/clone.2
> +++ b/man2/clone.2
> @@ -1628,7 +1628,7 @@ main(int argc, char *argv[])
>
> stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
> MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, \-1, 0);
> - if (stack == NULL)
> + if (stack == MAP_FAILED)
> errExit("mmap");
>
> stackTop = stack + STACK_SIZE; /* Assume stack grows downward */
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
Powered by blists - more mailing lists