From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755325Ab3GKQgF (ORCPT ); Thu, 11 Jul 2013 12:36:05 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:50030 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412Ab3GKQgD (ORCPT ); Thu, 11 Jul 2013 12:36:03 -0400 Message-ID: <51DEDEEF.6090800@gmail.com> Date: Thu, 11 Jul 2013 10:35:59 -0600 From: David Ahern User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: acme@ghostprotocols.net CC: linux-kernel@vger.kernel.org, Ingo Molnar , Frederic Weisbecker , Peter Zijlstra , Jiri Olsa , Namhyung Kim Subject: Re: [PATCH 3/6] perf event: initialize allocated memory for synthesized events References: <1372793245-4136-1-git-send-email-dsahern@gmail.com> <1372793245-4136-4-git-send-email-dsahern@gmail.com> In-Reply-To: <1372793245-4136-4-git-send-email-dsahern@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnaldo: Don't see this one in your perf/core branch. On 7/2/13 1:27 PM, David Ahern wrote: > Fixes valgrind complaint: > > =3118== Syscall param write(buf) points to uninitialised byte(s) > ==3118== at 0x4E3F5B0: __write_nocancel (in /lib64/libpthread-2.14.90.so) > ==3118== by 0x42F0EB: process_synthesized_event (builtin-record.c:89) > ==3118== by 0x44E81C: perf_event__synthesize_mmap_events (event.c:230) > ==3118== by 0x44F27C: perf_event__synthesize_threads (event.c:307) > ==3118== by 0x42FEEA: cmd_record (builtin-record.c:530) > ==3118== by 0x419D22: run_builtin (perf.c:319) > ==3118== by 0x4195A2: main (perf.c:376) > > Signed-off-by: David Ahern > Cc: Ingo Molnar > Cc: Frederic Weisbecker > Cc: Peter Zijlstra > Cc: Jiri Olsa > Cc: Namhyung Kim > --- > tools/perf/util/event.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c > index 5cd13d7..556b999 100644 > --- a/tools/perf/util/event.c > +++ b/tools/perf/util/event.c > @@ -316,11 +316,11 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, > union perf_event *comm_event, *mmap_event; > int err = -1, thread, j; > > - comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size); > + comm_event = zalloc(sizeof(comm_event->comm) + machine->id_hdr_size); > if (comm_event == NULL) > goto out; > > - mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); > + mmap_event = zalloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); > if (mmap_event == NULL) > goto out_free_comm; > > @@ -375,11 +375,11 @@ int perf_event__synthesize_threads(struct perf_tool *tool, > union perf_event *comm_event, *mmap_event; > int err = -1; > > - comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size); > + comm_event = zalloc(sizeof(comm_event->comm) + machine->id_hdr_size); > if (comm_event == NULL) > goto out; > > - mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); > + mmap_event = zalloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); > if (mmap_event == NULL) > goto out_free_comm; > >