[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1493209268-5543-3-git-send-email-treeze.taeung@gmail.com>
Date: Wed, 26 Apr 2017 21:21:03 +0900
From: Taeung Song <treeze.taeung@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Taeung Song <treeze.taeung@...il.com>
Subject: [PATCH 2/7] perf config: Check list empty before showing configs
If existent config files contains nothing,
the sections list in config_set can be empty.
So check not only NULL pointer of config_set but
also the list in config_set.
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Signed-off-by: Taeung Song <treeze.taeung@...il.com>
---
tools/perf/builtin-config.c | 4 ++--
tools/perf/util/config.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 80668fa..9ec8664 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -75,7 +75,7 @@ static int show_spec_config(struct perf_config_set *set, const char *var)
struct perf_config_section *section;
struct perf_config_item *item;
- if (set == NULL)
+ if (set == NULL || list_empty(&set->sections))
return -1;
perf_config_items__for_each_entry(&set->sections, section) {
@@ -105,7 +105,7 @@ static int show_config(struct perf_config_set *set)
struct perf_config_section *section;
struct perf_config_item *item;
- if (set == NULL)
+ if (set == NULL || list_empty(&set->sections))
return -1;
perf_config_set__for_each_entry(set, section, item) {
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 8d724f0..492c862 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -707,7 +707,7 @@ int perf_config(config_fn_t fn, void *data)
struct perf_config_section *section;
struct perf_config_item *item;
- if (config_set == NULL)
+ if (config_set == NULL || list_empty(&config_set->sections))
return -1;
perf_config_set__for_each_entry(config_set, section, item) {
--
2.7.4
Powered by blists - more mailing lists