[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-l0kcbcg5f4nnzqt01cv42vec@git.kernel.org>
Date: Sat, 28 Feb 2015 01:31:25 -0800
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: namhyung@...nel.org, dsahern@...il.com, naota@...sp.net,
hpa@...or.com, jolsa@...hat.com, masami.hiramatsu.pt@...achi.com,
acme@...hat.com, linux-kernel@...r.kernel.org, tglx@...utronix.de,
mingo@...nel.org
Subject: [tip:perf/core] perf probe: Handle strdup() failure
Commit-ID: 38ae502b1df196f712f6f5d3609afc36337b330b
Gitweb: http://git.kernel.org/tip/38ae502b1df196f712f6f5d3609afc36337b330b
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Thu, 26 Feb 2015 11:47:18 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Fri, 27 Feb 2015 10:08:29 -0300
perf probe: Handle strdup() failure
We could end up returning 0 (Ok) with a NULL raw_path. Fix it.
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Naohiro Aota <naota@...sp.net>
Link: http://lkml.kernel.org/n/tip-l0kcbcg5f4nnzqt01cv42vec@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/probe-event.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 4a93bf4..9526cf3 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -533,7 +533,7 @@ static int get_real_path(const char *raw_path, const char *comp_dir,
else {
if (access(raw_path, R_OK) == 0) {
*new_path = strdup(raw_path);
- return 0;
+ return *new_path ? 0 : -ENOMEM;
} else
return -errno;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists