All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Hemant Kumar <hemant@linux.vnet.ibm.com>, linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org, acme@kernel.org,
	scottwood@freescale.com, sukadev@linux.vnet.ibm.com,
	naveen.n.rao@linux.vnet.ibm.com, mpe@ellerman.id.au,
	paulus@samba.org, mingo@redhat.com, yarygin@linux.vnet.ibm.com,
	borntraeger@de.ibm.com, srikar@linux.vnet.ibm.com
Subject: Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h
Date: Wed, 7 Oct 2015 10:11:43 -0600	[thread overview]
Message-ID: <5615443F.7030909@gmail.com> (raw)
In-Reply-To: <1444184711-8559-1-git-send-email-hemant@linux.vnet.ibm.com>

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.

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

David

  parent reply	other threads:[~2015-10-07 16:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-07  2:25 [PATCH v9 1/4] perf, kvm/{x86, s390}: Remove dependency on uapi/kvm_perf.h Hemant Kumar
2015-10-07  2:25 ` [PATCH v9 1/4] perf,kvm/{x86,s390}: " Hemant Kumar
2015-10-07  2:25 ` [PATCH v9 2/4] perf,kvm/{x86,s390}: Remove const from kvm_events_tp Hemant Kumar
2015-10-07  2:25 ` [PATCH v9 3/4] perf,kvm/powerpc: Port perf kvm stat to powerpc Hemant Kumar
2015-10-07  2:25 ` [PATCH v9 4/4] perf,kvm/powerpc: Add support for HCALL reasons Hemant Kumar
2015-10-07 16:11 ` David Ahern [this message]
2015-10-08  9:39   ` [PATCH v9 1/4] perf, kvm/{x86, s390}: Remove dependency on uapi/kvm_perf.h Hemant Kumar
2015-10-08  9:39     ` [PATCH v9 1/4] perf,kvm/{x86,s390}: " Hemant Kumar
2015-10-28 20:47     ` [PATCH v9 1/4] perf, kvm/{x86, s390}: " Alexander Yarygin
2015-10-28 20:47       ` [PATCH v9 1/4] perf,kvm/{x86,s390}: " Alexander Yarygin
2015-10-29  7:07       ` [PATCH v9 1/4] perf, kvm/{x86, s390}: " Hemant Kumar
2015-10-29  7:07         ` [PATCH v9 1/4] perf,kvm/{x86,s390}: " Hemant Kumar
2015-10-26  8:26 ` [PATCH v9 1/4] perf, kvm/{x86, s390}: " Hemant Kumar
2015-10-26  8:26   ` [PATCH v9 1/4] perf,kvm/{x86,s390}: " Hemant Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5615443F.7030909@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@kernel.org \
    --cc=borntraeger@de.ibm.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=scottwood@freescale.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=yarygin@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.