lkml.org 
[lkml]   [2014]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] perf tools: Check validity of --symfs value
Date
If a symfs is given by user, it needs to be checked before applying.
Currently, it just uses it even if realpath() failed.

I guess it's because it needed to handle empty symfs which is the
default value. But now it's only called when it's not empty so it'd
be better to check before using it and warn users if failed.

Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 90723a12e947..95186185c1d5 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1864,8 +1864,11 @@ int symbol__init(void)

if (*symbol_conf.symfs) {
symfs = realpath(symbol_conf.symfs, NULL);
- if (symfs == NULL)
- symfs = (char *)symbol_conf.symfs;
+ if (symfs == NULL) {
+ pr_err("cannot apply symfs: %s: %s\n",
+ symbol_conf.symfs, strerror(errno));
+ return -1;
+ }

/*
* A path to symbols of "/" is identical to ""
--
2.0.0


\
 
 \ /
  Last update: 2014-07-25 04:21    [W:0.079 / U:1.896 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site