lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 5 Apr 2018 09:17:01 +0300
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] perf auxtrace: Make auxtrace_queues__add_buffer()
 allocate struct buffer

On 07/03/18 16:11, Arnaldo Carvalho de Melo wrote:
> Em Wed, Mar 07, 2018 at 10:06:50AM +0200, Adrian Hunter escreveu:
>> On 06/03/18 22:25, Arnaldo Carvalho de Melo wrote:
>>> Em Tue, Mar 06, 2018 at 11:13:17AM +0200, Adrian Hunter escreveu:
>>>> In preparation for supporting AUX area sampling buffers,
>>>> auxtrace_queues__add_buffer() needs to be more generic. To that end, move
>>>> memory allocation for struct buffer into it.
>>>>
>>>> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
>>>> ---
>>>>  tools/perf/util/auxtrace.c | 54 +++++++++++++++++++++-------------------------
>>>>  1 file changed, 24 insertions(+), 30 deletions(-)
>>>>
>>>> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
>>>> index fb357a00dd86..e1aff91c54a8 100644
>>>> --- a/tools/perf/util/auxtrace.c
>>>> +++ b/tools/perf/util/auxtrace.c
>>>> @@ -308,7 +308,11 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
>>>>  				       struct auxtrace_buffer *buffer,
>>>>  				       struct auxtrace_buffer **buffer_ptr)
>>>>  {
>>>> -	int err;
>>>> +	int err = -ENOMEM;
>>>> +
>>>> +	buffer = memdup(buffer, sizeof(*buffer));
>>>
>>> this is a bit strange, why not make buffer a local variable in this
>>> function then?
>>
>> Do you mean the following?
>>
>> 	struct auxtrace_buffer *new_buf;
>>
>> 	new_buf = memdup(buffer, sizeof(*buffer));
> 
> I hadn't noticed that you were using buffer as both r and l value :-\
> 
> If all you want is to receive that buffer, duplicate it and then use
> just the duplicate, not needing any reference to the original buffer,
> then your code is correct, it just looked strange from a quick look, so
> nevermind, I'll continue processing this one and the others.

Looks like this patch and patch 7 "perf auxtrace: Make
auxtrace_queues__add_buffer() do CPU filtering" got left behind.  They still
apply cleanly.

Powered by blists - more mailing lists