[lkml]   [2017]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[tip:perf/core] perf inject: Don't proceed if perf_session__process_event() fails
Commit-ID:  bb8d521f77f3e68a713456b7fb1e99f52ff3342c
Author: David Carrillo-Cisneros <>
AuthorDate: Mon, 10 Apr 2017 13:14:26 -0700
Committer: Arnaldo Carvalho de Melo <>
CommitDate: Tue, 11 Apr 2017 15:23:40 -0300

perf inject: Don't proceed if perf_session__process_event() fails

All paths following perf_session__process_event() in __cmd_inject() are
useless if __cmd_inject() is to fail, some depend on a correct

First commit to add code that depends on session->evlist without checking
error was commmit e558a5bd8b ("perf inject: Work with files"). It has
grown since then.

Change __cmd_inject() to fail immediately after
perf_session__process_event() fails.

Signed-off-by: David Carrillo-Cisneros <>
Acked-by: Jiri Olsa <>
Cc: Alexander Shishkin <>
Cc: Andi Kleen <>
Cc: Andrew Vagin <>
Cc: He Kuang <>
Cc: Masami Hiramatsu <>
Cc: Paul Turner <>
Cc: Peter Zijlstra <>
Cc: Simon Que <>
Cc: Stephane Eranian <>
Cc: Wang Nan <>
Fixes: e558a5bd8b74 ("perf inject: Work with files")
Signed-off-by: Arnaldo Carvalho de Melo <>
tools/perf/builtin-inject.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 42dff0b..65e1c02 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -694,6 +694,8 @@ static int __cmd_inject(struct perf_inject *inject)
lseek(fd, output_data_offset, SEEK_SET);

ret = perf_session__process_events(session);
+ if (ret)
+ return ret;

if (!file_out->is_pipe) {
if (inject->build_ids)
 \ /
  Last update: 2017-04-12 07:44    [W:0.133 / U:11.976 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site