From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755552AbbJHJkA (ORCPT ); Thu, 8 Oct 2015 05:40:00 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:51611 "EHLO e28smtp09.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755400AbbJHJj6 (ORCPT ); Thu, 8 Oct 2015 05:39:58 -0400 X-Helo: d28dlp01.in.ibm.com X-MailFrom: hemant@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Message-ID: <561639B8.8040407@linux.vnet.ibm.com> Date: Thu, 08 Oct 2015 15:09:04 +0530 From: Hemant Kumar User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: David Ahern , linux-kernel@vger.kernel.org CC: srikar@linux.vnet.ibm.com, yarygin@linux.vnet.ibm.com, acme@kernel.org, borntraeger@de.ibm.com, mingo@redhat.com, paulus@samba.org, scottwood@freescale.com, naveen.n.rao@linux.vnet.ibm.com, sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h References: <1444184711-8559-1-git-send-email-hemant@linux.vnet.ibm.com> <5615443F.7030909@gmail.com> In-Reply-To: <5615443F.7030909@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15100809-0033-0000-0000-0000083185AD Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On 10/07/2015 09:41 PM, David Ahern wrote: > On 10/6/15 8:25 PM, Hemant Kumar wrote: >> @@ -358,7 +357,12 @@ static bool handle_end_event(struct >> perf_kvm_stat *kvm, >> time_diff = sample->time - time_begin; >> >> if (kvm->duration && time_diff > kvm->duration) { >> - char decode[DECODE_STR_LEN]; >> + char *decode = zalloc(decode_str_len); > > decode can still be a stack variable even with variable length. > Yeah, we can do that. But, I am not sure whether its a standard way. >> + >> + if (!decode) { >> + pr_err("Not enough memory\n"); >> + return false; >> + } >> >> kvm->events_ops->decode_key(kvm, &event->key, decode); >> if (!skip_event(decode)) { >> @@ -366,6 +370,7 @@ static bool handle_end_event(struct perf_kvm_stat >> *kvm, >> sample->time, sample->pid, vcpu_record->vcpu_id, >> decode, time_diff/1000); >> } >> + free(decode); >> } >> >> return update_kvm_event(event, vcpu, time_diff); >> @@ -386,7 +391,8 @@ struct vcpu_event_record *per_vcpu_record(struct >> thread *thread, > > -----8<----- > >> @@ -575,7 +581,7 @@ static void show_timeofday(void) >> >> static void print_result(struct perf_kvm_stat *kvm) >> { >> - char decode[DECODE_STR_LEN]; >> + char *decode; > > and a stack variable here too. > Same here. > David > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev -- Thanks, Hemant Kumar