[PATCH 6/7] perf: Do not allow empty debugfs-dir option

From: Borislav Petkov
Date: Wed Feb 20 2013 - 10:32:51 EST


From: Borislav Petkov <bp@xxxxxxx>

Catch empty --debugfs-dir= option and exit early.

Signed-off-by: Borislav Petkov <bp@xxxxxxx>
---
tools/perf/perf.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index f6ba7b73f40e..25f108480ac6 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -199,6 +199,10 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
(*argv)++;
(*argc)--;
} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
+ if (strlen(cmd) == strlen(CMD_DEBUGFS_DIR)) {
+ fprintf(stderr, "No directory given for --debugfs-dir.\n");
+ usage(perf_usage_string);
+ }
perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
fprintf(stderr, "dir: %s\n", debugfs_mountpoint);
if (envchanged)
--
1.8.1.3.535.ga923c31

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/