* [PATCH -tip] perf tools: Don't allow empty argument for field-separator.
@ 2015-03-20 2:57 Wang Nan
2015-03-20 13:18 ` Arnaldo Carvalho de Melo
2015-03-22 10:14 ` [tip:perf/core] perf tools: Don' t " tip-bot for Wang Nan
0 siblings, 2 replies; 3+ messages in thread
From: Wang Nan @ 2015-03-20 2:57 UTC (permalink / raw)
To: mingo, acme, namhyung; +Cc: lizefan, linux-kernel, pi3orama
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>
---
This patch is based on Arnaldo's pull request for Ingo:
Commit 0c8c20779c5d56b93b8cb4cd30ba129a927ab437
---
tools/perf/builtin-diff.c | 2 +-
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 f800fc9..473887d 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -802,7 +802,7 @@ static const struct option options[] = {
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
" Please refer the man page for the complete list."),
- OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
+ OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator",
"separator for columns, no spaces will be added between "
"columns '.' is reserved."),
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 46c6931..b4dcf0b 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)
"input file name"),
OPT_STRING('C', "cpu", &mem.cpu_list, "cpu",
"list of cpus to profile"),
- OPT_STRING('x', "field-separator", &symbol_conf.field_sep,
+ OPT_STRING_NOEMPTY('x', "field-separator", &symbol_conf.field_sep,
"separator",
"separator for columns, no spaces will be added"
" between columns '.' is reserved."),
--
1.8.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -tip] perf tools: Don't allow empty argument for field-separator.
2015-03-20 2:57 [PATCH -tip] perf tools: Don't allow empty argument for field-separator Wang Nan
@ 2015-03-20 13:18 ` Arnaldo Carvalho de Melo
2015-03-22 10:14 ` [tip:perf/core] perf tools: Don' t " tip-bot for Wang Nan
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-20 13:18 UTC (permalink / raw)
To: Wang Nan; +Cc: mingo, namhyung, lizefan, linux-kernel, pi3orama
Em Fri, Mar 20, 2015 at 02:57:52AM +0000, Wang Nan escreveu:
> 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>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf tools: Don' t allow empty argument for field-separator
2015-03-20 2:57 [PATCH -tip] perf tools: Don't allow empty argument for field-separator Wang Nan
2015-03-20 13:18 ` Arnaldo Carvalho de Melo
@ 2015-03-22 10:14 ` tip-bot for Wang Nan
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Wang Nan @ 2015-03-22 10:14 UTC (permalink / raw)
To: linux-tip-commits
Cc: lizefan, namhyung, wangnan0, acme, linux-kernel, hpa, mingo, tglx
Commit-ID: 8b8ca6e15e392b366a7d69c6bf1abaae005f2b63
Gitweb: http://git.kernel.org/tip/8b8ca6e15e392b366a7d69c6bf1abaae005f2b63
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Fri, 20 Mar 2015 02:57:52 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 20 Mar 2015 17:49:51 -0300
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>
---
tools/perf/builtin-diff.c | 2 +-
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 f800fc9..473887d 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -802,7 +802,7 @@ static const struct option options[] = {
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
" Please refer the man page for the complete list."),
- OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
+ OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator",
"separator for columns, no spaces will be added between "
"columns '.' is reserved."),
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 46c6931..b4dcf0b 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)
"input file name"),
OPT_STRING('C', "cpu", &mem.cpu_list, "cpu",
"list of cpus to profile"),
- OPT_STRING('x', "field-separator", &symbol_conf.field_sep,
+ OPT_STRING_NOEMPTY('x', "field-separator", &symbol_conf.field_sep,
"separator",
"separator for columns, no spaces will be added"
" between columns '.' is reserved."),
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-22 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 2:57 [PATCH -tip] perf tools: Don't allow empty argument for field-separator Wang Nan
2015-03-20 13:18 ` Arnaldo Carvalho de Melo
2015-03-22 10:14 ` [tip:perf/core] perf tools: Don' t " tip-bot for Wang Nan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).