All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Linux Weekly News <lwn@lwn.net>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 04/13] tools lib traceevent: Fix kbuffer_read_at_offset()
Date: Thu,  6 Oct 2016 13:11:47 -0300	[thread overview]
Message-ID: <1475770316-20057-5-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1475770316-20057-1-git-send-email-acme@kernel.org>

From: Namhyung Kim <namhyung@kernel.org>

When it's called with an offset less than or equal to the first event,
it'll return a garbage value since the data is not initialized.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161001101700.29146-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/kbuffer-parse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
index 3bcada3ae05a..65984f1c2974 100644
--- a/tools/lib/traceevent/kbuffer-parse.c
+++ b/tools/lib/traceevent/kbuffer-parse.c
@@ -622,6 +622,7 @@ void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset,
 
 	/* Reset the buffer */
 	kbuffer_load_subbuffer(kbuf, kbuf->subbuffer);
+	data = kbuffer_read_event(kbuf, ts);
 
 	while (kbuf->curr < offset) {
 		data = kbuffer_next_event(kbuf, ts);
-- 
2.7.4

  parent reply	other threads:[~2016-10-06 16:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 16:11 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 01/13] perf uretprobe ppc64le: Fix probe location Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 02/13] perf intel-pt: Fix estimated timestamps for cycle-accurate mode Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 03/13] perf intel-pt: Fix MTC timestamp calculation for large MTC periods Arnaldo Carvalho de Melo
2016-10-06 16:11 ` Arnaldo Carvalho de Melo [this message]
2016-10-06 16:11 ` [PATCH 05/13] perf jevents: Fix Intel JSON fixed counter conversions Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 06/13] perf bench mem: Sync memcpy assembly sources with the kernel Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 07/13] tools: Synchronize tools/arch/x86/include/asm/cpufeatures.h Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 08/13] tools: Synchronize tools/include/uapi/linux/bpf.h Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 09/13] perf report/top: Add a tip about source line numbers with overhead Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 10/13] perf report/top: Add a tip about system-wide collection from all CPUs Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 11/13] perf top/report: Add tips about a list option Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 12/13] tools build: Support compiling C++ source file Arnaldo Carvalho de Melo
2016-10-06 16:11 ` [PATCH 13/13] tools build: Add feature detection for g++ Arnaldo Carvalho de Melo
2016-10-06 22:38 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar

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=1475770316-20057-5-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lwn@lwn.net \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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.