[lkml]   [2017]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3.16 040/134] perf inject: Don't proceed if perf_session__process_event() fails
3.16.47-rc1 review patch.  If anyone has any objections, please let me know.


From: David Carrillo-Cisneros <>

commit bb8d521f77f3e68a713456b7fb1e99f52ff3342c upstream.

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 <>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <>
tools/perf/builtin-inject.c | 2 ++
1 file changed, 2 insertions(+)

--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -387,6 +387,8 @@ static int __cmd_inject(struct perf_inje
lseek(file_out->fd, session->header.data_offset, SEEK_SET);

ret = perf_session__process_events(session, &inject->tool);
+ if (ret)
+ return ret;

if (!file_out->is_pipe) {
session->header.data_size = inject->bytes_written;
 \ /
  Last update: 2017-08-18 15:46    [W:0.345 / U:2.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site