Re: [PATCH (2) 14/34] cmsg.3: Use sizeof consistently

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

 



Hi Alex,

On 9/4/20 3:52 PM, Alejandro Colomar wrote:
>>From 374b31bee6762314ab48988e2e78a3a6a2f96834 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
> Date: Thu, 3 Sep 2020 21:44:54 +0200
> Subject: [PATCH 14/34] cmsg.3: 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@xxxxxxxxx>
> ---
>  man3/cmsg.3 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/man3/cmsg.3 b/man3/cmsg.3
> index 3d6288901..8d0ad6666 100644
> --- a/man3/cmsg.3
> +++ b/man3/cmsg.3
> @@ -241,8 +241,8 @@ msg.msg_controllen = sizeof(u.buf);
>  cmsg = CMSG_FIRSTHDR(&msg);
>  cmsg\->cmsg_level = SOL_SOCKET;
>  cmsg\->cmsg_type = SCM_RIGHTS;
> -cmsg\->cmsg_len = CMSG_LEN(sizeof(int) * NUM_FD);
> -memcpy(CMSG_DATA(cmsg), myfds, sizeof(int) * NUM_FD);
> +cmsg\->cmsg_len = CMSG_LEN(sizeof(myfds));
> +memcpy(CMSG_DATA(cmsg), myfds, sizeof(myfds));
>  .EE
>  .in
>  .SH SEE ALSO

Thanks. Patch applied.

Cheers,

Michael



-- 
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