lkml.org 
[lkml]   [2013]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf evsel: fix NULL pointer deference when evsel->counts is NULL
On 23/01/13 22:02, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jan 21, 2013 at 01:53:21PM +0900, Namhyung Kim escreveu:
>> On Sat, 19 Jan 2013 16:36:54 +0000, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>
>>> __perf_evsel__read_on_cpu() only bails out with -ENOMEM if
>>> evsel->counts is NULL and perf_evsel__alloc_counts() has returned
>>> an error. If perf_evsel__alloc_counts() does not return an error
>>> we get an NULL pointer deference on evsel->counts->cpu[cpu]
>>> if evsel->counts is NULL.
>
>> perf_evsel__alloc_counts() should allocate evsel->counts when it sees
>> evsel->counts is NULL and return negative error code if the allocation
>> fails.
>
>> So I don't see any problem in current code. With your code, it won't
>> try to allocate if ->counts is NULL but overwrite existing ->counts?
>
> Right, the patch introduces a problem in code that works perfectly :-)
>
> - Arnaldo
>
Apologies for the noise.

Colin


\
 
 \ /
  Last update: 2013-01-24 01:02    [W:0.055 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site