Re: [PATCH (2) 06/34] perf_event_open.2: Use sizeof consistently

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

 



Hello Alex,

On 9/4/20 12:56 PM, Alejandro Colomar wrote:
>>From dbb7b520bd4314488122835c87f45b685ce45b28 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
> Date: Thu, 3 Sep 2020 21:29:02 +0200
> Subject: [PATCH 06/34] perf_event_open.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


Patch applied.

Cheers,

Michael

> Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
> ---
>  man2/perf_event_open.2 | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/man2/perf_event_open.2 b/man2/perf_event_open.2
> index 2492fc75a..ea5ee725f 100644
> --- a/man2/perf_event_open.2
> +++ b/man2/perf_event_open.2
> @@ -3419,9 +3419,9 @@ main(int argc, char **argv)
>      long long count;
>      int fd;
> 
> -    memset(&pe, 0, sizeof(struct perf_event_attr));
> +    memset(&pe, 0, sizeof(pe));
>      pe.type = PERF_TYPE_HARDWARE;
> -    pe.size = sizeof(struct perf_event_attr);
> +    pe.size = sizeof(pe);
>      pe.config = PERF_COUNT_HW_INSTRUCTIONS;
>      pe.disabled = 1;
>      pe.exclude_kernel = 1;
> 


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