public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: acme@kernel.org, jolsa@kernel.org, namhyung@kernel.org,
	irogers@google.com, james.clark@arm.com, mpe@ellerman.id.au,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
	rnsastry@linux.ibm.com, kjain@linux.ibm.com,
	disgoel@linux.ibm.com
Subject: Re: [PATCH] [perf/core: Update sample_flags for raw_data in perf_output_sample
Date: Thu, 20 Oct 2022 16:40:39 +0200	[thread overview]
Message-ID: <Y1Fd57P5I+aSNT/V@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20221020070657.21571-1-atrajeev@linux.vnet.ibm.com>

On Thu, Oct 20, 2022 at 12:36:56PM +0530, Athira Rajeev wrote:
> commit 838d9bb62d13 ("perf: Use sample_flags for raw_data")
> added check for PERF_SAMPLE_RAW in sample_flags in
> perf_prepare_sample(). But while copying the sample in memory,
> the check for sample_flags is not added in perf_output_sample().
> Fix adds the same in perf_output_sample as well.
> 
> Fixes: 838d9bb62d13 ("perf: Use sample_flags for raw_data")
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 4ec3717003d5..daf387c75d33 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7099,7 +7099,7 @@ void perf_output_sample(struct perf_output_handle *handle,
>  	if (sample_type & PERF_SAMPLE_RAW) {
>  		struct perf_raw_record *raw = data->raw;
>  
> -		if (raw) {
> +		if (raw && (data->sample_flags & PERF_SAMPLE_RAW)) {
>  			struct perf_raw_frag *frag = &raw->frag;
>  
>  			perf_output_put(handle, raw->size);

Urgh.. something smells here. We already did a PERF_SAMPLE_RAW test.

And perf_prepare_sample() explicitly makes data->raw be NULL when not
set earlier.

So what's going wrong?


  parent reply	other threads:[~2022-10-20 14:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  7:06 [PATCH] [perf/core: Update sample_flags for raw_data in perf_output_sample Athira Rajeev
2022-10-20  7:06 ` Athira Rajeev
2022-10-20 14:40 ` Peter Zijlstra [this message]
2022-11-02  8:19   ` Athira Rajeev

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=Y1Fd57P5I+aSNT/V@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=disgoel@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=namhyung@kernel.org \
    --cc=rnsastry@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox