Re: [PATCH (2) 04/34] futex.2: Use sizeof consistently

Michael Kerrisk (man-pages)
2020-09-04T12:19:47Z

Hello Alex,

On 9/4/20 12:54 PM, Alejandro Colomar wrote:
>>From 21cd85c6f11390c71ed4475f1f9d55910891cf23 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@gmail.com>
> Date: Thu, 3 Sep 2020 21:27:01 +0200
> Subject: [PATCH 04/34] futex.2: Use sizeof consistently
>
> Use ``sizeof`` consistently through all the examples in the following
> way:
>
> - Use the name of the variable instead of its type as argument for
> ``sizeof``.
>
> Rationale:
> https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory
>
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>

Patch applied.

Cheers,

Michael

> ---
> man2/futex.2 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man2/futex.2 b/man2/futex.2
> index 05696f617..6192b145a 100644
> --- a/man2/futex.2
> +++ b/man2/futex.2
> @@ -1839,7 +1839,7 @@ main(int argc, char *argv[])
> subsequently use the "shared" futex operations (i.e., not the
> ones suffixed "_PRIVATE") */
>
> - iaddr = mmap(NULL, sizeof(int) * 2, PROT_READ | PROT_WRITE,
> + iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,
> MAP_ANONYMOUS | MAP_SHARED, \-1, 0);
> if (iaddr == MAP_FAILED)
> errExit("mmap");
>

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/