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


Groups > linux.kernel > #1494389

[PATCH] tools lib traceevent: Fix kbuffer_read_at_offset()

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH] tools lib traceevent: Fix kbuffer_read_at_offset()
Date 2016-10-01 12:20 +0200
Message-ID <snpyF-71K-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 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.10.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] tools lib traceevent: Fix kbuffer_read_at_offset() Namhyung Kim <namhyung@kernel.org> - 2016-10-01 12:20 +0200
  Re: [PATCH] tools lib traceevent: Fix kbuffer_read_at_offset() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-05 13:40 +0200
  Re: [PATCH] tools lib traceevent: Fix kbuffer_read_at_offset() Steven Rostedt <rostedt@goodmis.org> - 2016-10-05 15:30 +0200
    Re: [PATCH] tools lib traceevent: Fix kbuffer_read_at_offset() Namhyung Kim <namhyung@kernel.org> - 2016-10-07 06:20 +0200
      Re: [PATCH] tools lib traceevent: Fix kbuffer_read_at_offset() Steven Rostedt <rostedt@goodmis.org> - 2016-10-07 16:10 +0200
  [tip:perf/urgent] tools lib traceevent: Fix  kbuffer_read_at_offset() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-10-07 00:50 +0200

csiph-web