Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569400 > unrolled thread

[PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()

Started byTaeung Song <treeze.taeung@gmail.com>
First post2017-01-30 06:30 +0100
Last post2017-01-30 11:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output() Taeung Song <treeze.taeung@gmail.com> - 2017-01-30 06:30 +0100
    Re: [PATCH 2/2] perf evsel: Check for NULL before  perf_evsel__is_bpf_output() Jiri Olsa <jolsa@redhat.com> - 2017-01-30 10:00 +0100
      Re: [PATCH 2/2] perf evsel: Check for NULL before  perf_evsel__is_bpf_output() Taeung Song <treeze.taeung@gmail.com> - 2017-01-30 11:40 +0100

#1569400 — [PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()

FromTaeung Song <treeze.taeung@gmail.com>
Date2017-01-30 06:30 +0100
Subject[PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()
Message-ID<t5cHn-8r7-1@gated-at.bofh.it>
If 'evsel' is NULL, in perf_evsel__is_bpf_output()
NULL pointer error can happen so check it.

Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/util/evsel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 04e536a..b77da72 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -242,8 +242,10 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
 {
 	struct perf_evsel *evsel = zalloc(perf_evsel__object.size);
 
-	if (evsel != NULL)
-		perf_evsel__init(evsel, attr, idx);
+	if (!evsel)
+		return NULL;
+
+	perf_evsel__init(evsel, attr, idx);
 
 	if (perf_evsel__is_bpf_output(evsel)) {
 		evsel->attr.sample_type |= (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
-- 
2.7.4

[toc] | [next] | [standalone]


#1569468 — Re: [PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()

FromJiri Olsa <jolsa@redhat.com>
Date2017-01-30 10:00 +0100
SubjectRe: [PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()
Message-ID<t5fYC-1PU-5@gated-at.bofh.it>
In reply to#1569400
On Mon, Jan 30, 2017 at 02:23:39PM +0900, Taeung Song wrote:
> If 'evsel' is NULL, in perf_evsel__is_bpf_output()
> NULL pointer error can happen so check it.
> 
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
>  tools/perf/util/evsel.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 04e536a..b77da72 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -242,8 +242,10 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
>  {
>  	struct perf_evsel *evsel = zalloc(perf_evsel__object.size);
>  
> -	if (evsel != NULL)
> -		perf_evsel__init(evsel, attr, idx);
> +	if (!evsel)
> +		return NULL;
> +
> +	perf_evsel__init(evsel, attr, idx);

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

[toc] | [prev] | [next] | [standalone]


#1569567 — Re: [PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()

FromTaeung Song <treeze.taeung@gmail.com>
Date2017-01-30 11:40 +0100
SubjectRe: [PATCH 2/2] perf evsel: Check for NULL before perf_evsel__is_bpf_output()
Message-ID<t5hxo-2QU-9@gated-at.bofh.it>
In reply to#1569468
Hi, jirka :)

Thank you!
Taeung

On 01/30/2017 05:55 PM, Jiri Olsa wrote:
> On Mon, Jan 30, 2017 at 02:23:39PM +0900, Taeung Song wrote:
>> If 'evsel' is NULL, in perf_evsel__is_bpf_output()
>> NULL pointer error can happen so check it.
>>
>> Cc: Jiri Olsa <jolsa@redhat.com>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
>> ---
>>  tools/perf/util/evsel.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>> index 04e536a..b77da72 100644
>> --- a/tools/perf/util/evsel.c
>> +++ b/tools/perf/util/evsel.c
>> @@ -242,8 +242,10 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
>>  {
>>  	struct perf_evsel *evsel = zalloc(perf_evsel__object.size);
>>
>> -	if (evsel != NULL)
>> -		perf_evsel__init(evsel, attr, idx);
>> +	if (!evsel)
>> +		return NULL;
>> +
>> +	perf_evsel__init(evsel, attr, idx);
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
>
> thanks,
> jirka
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web