]> git.karo-electronics.de Git - linux-beck.git/commit
perf report: Don't allow empty argument for '-t'.
authorWang Nan <wangnan0@huawei.com>
Fri, 13 Mar 2015 12:51:54 +0000 (12:51 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 19 Mar 2015 16:53:28 +0000 (13:53 -0300)
commit0c8c20779c5d56b93b8cb4cd30ba129a927ab437
tree834448d6d5be440844e1ba755e6cf3a5832dfec6
parent303cb89a6d708da9c24f6f3390ff68a2bd822a13
perf report: Don't allow empty argument for '-t'.

Without this patch, perf report cause segfault if pass "" as '-t':

  $ perf report -t ""

   # To display the perf.data header info, please use --header/--header-only options.
   #
   # Samples: 37  of event 'syscalls:sys_enter_write'
   # Event count (approx.): 37
   #
   # Children    SelfCommand   Shared Object         Symbol
   Segmentation fault

Since -t is used to add field-separator for generate table, -t "" is
actually meanless. This patch defines a new OPT_STRING_NOEMPTY() option
generator to ensure user never pass empty string to that option.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: pi3orama@163.com
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/1426251114-198991-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c
tools/perf/util/parse-options.c
tools/perf/util/parse-options.h