diff options
author | Wang Nan <wangnan0@huawei.com> | 2015-03-19 22:57:52 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-03-20 16:49:51 -0400 |
commit | 8b8ca6e15e392b366a7d69c6bf1abaae005f2b63 (patch) | |
tree | 64df00847713dd35e37580f5bf9ff615e0574a1b /tools | |
parent | 0635b0f71424be7706793ac260d063491a2889a0 (diff) |
perf tools: Don't allow empty argument for field-separator
Both 'perf diff' and 'perf mem' have 'field-separator' option, which
causes segfault if passed with empty string. This patch uses previously
introduced 'OPT_STRING_NOEMPTY' option macro to prevent fault.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: pi3orama@163.com
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/1426820272-23302-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-diff.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-mem.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index f800fc95f5d7..473887d1d61a 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -802,7 +802,7 @@ static const struct option options[] = { | |||
802 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 802 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
803 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." | 803 | "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." |
804 | " Please refer the man page for the complete list."), | 804 | " Please refer the man page for the complete list."), |
805 | OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator", | 805 | OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator", |
806 | "separator for columns, no spaces will be added between " | 806 | "separator for columns, no spaces will be added between " |
807 | "columns '.' is reserved."), | 807 | "columns '.' is reserved."), |
808 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", | 808 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", |
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 46c69318de84..b4dcf0bfc029 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c | |||
@@ -286,7 +286,7 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
286 | "input file name"), | 286 | "input file name"), |
287 | OPT_STRING('C', "cpu", &mem.cpu_list, "cpu", | 287 | OPT_STRING('C', "cpu", &mem.cpu_list, "cpu", |
288 | "list of cpus to profile"), | 288 | "list of cpus to profile"), |
289 | OPT_STRING('x', "field-separator", &symbol_conf.field_sep, | 289 | OPT_STRING_NOEMPTY('x', "field-separator", &symbol_conf.field_sep, |
290 | "separator", | 290 | "separator", |
291 | "separator for columns, no spaces will be added" | 291 | "separator for columns, no spaces will be added" |
292 | " between columns '.' is reserved."), | 292 | " between columns '.' is reserved."), |