Re: [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/16/19 12:41 PM, Christian Brauner wrote:
> From: Christian Brauner <christian.brauner@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux