* [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config()
@ 2017-06-17 3:46 Taeung Song
2017-06-19 18:32 ` Arnaldo Carvalho de Melo
2017-06-20 9:07 ` [tip:perf/core] " tip-bot for Taeung Song
0 siblings, 2 replies; 3+ messages in thread
From: Taeung Song @ 2017-06-17 3:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Jiri Olsa, Namhyung Kim
show_spec_config() and set_config() can be called multiple times
in the loop in cmd_config().
However, The error cases of them wasn't checked, so fix it.
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
tools/perf/builtin-config.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 7545966..bb1be79 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -225,10 +225,23 @@ int cmd_config(int argc, const char **argv)
break;
}
- if (value == NULL)
+ if (value == NULL) {
ret = show_spec_config(set, var);
- else
+ if (ret < 0) {
+ pr_err("%s is not configured: %s\n",
+ var, config_filename);
+ free(arg);
+ break;
+ }
+ } else {
ret = set_config(set, config_filename, var, value);
+ if (ret < 0) {
+ pr_err("Failed to set '%s=%s' on %s\n",
+ var, value, config_filename);
+ free(arg);
+ break;
+ }
+ }
free(arg);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config()
2017-06-17 3:46 [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config() Taeung Song
@ 2017-06-19 18:32 ` Arnaldo Carvalho de Melo
2017-06-20 9:07 ` [tip:perf/core] " tip-bot for Taeung Song
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-19 18:32 UTC (permalink / raw)
To: Taeung Song; +Cc: linux-kernel, Jiri Olsa, Namhyung Kim
Em Sat, Jun 17, 2017 at 12:46:37PM +0900, Taeung Song escreveu:
> show_spec_config() and set_config() can be called multiple times
> in the loop in cmd_config().
> However, The error cases of them wasn't checked, so fix it.
Thanks, applied.
> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> ---
> tools/perf/builtin-config.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
> index 7545966..bb1be79 100644
> --- a/tools/perf/builtin-config.c
> +++ b/tools/perf/builtin-config.c
> @@ -225,10 +225,23 @@ int cmd_config(int argc, const char **argv)
> break;
> }
>
> - if (value == NULL)
> + if (value == NULL) {
> ret = show_spec_config(set, var);
> - else
> + if (ret < 0) {
> + pr_err("%s is not configured: %s\n",
> + var, config_filename);
> + free(arg);
> + break;
> + }
> + } else {
> ret = set_config(set, config_filename, var, value);
> + if (ret < 0) {
> + pr_err("Failed to set '%s=%s' on %s\n",
> + var, value, config_filename);
> + free(arg);
> + break;
> + }
> + }
> free(arg);
> }
> }
> --
> 2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread* [tip:perf/core] perf config: Check error cases of {show_spec, set}_config()
2017-06-17 3:46 [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config() Taeung Song
2017-06-19 18:32 ` Arnaldo Carvalho de Melo
@ 2017-06-20 9:07 ` tip-bot for Taeung Song
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Taeung Song @ 2017-06-20 9:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: treeze.taeung, mingo, jolsa, hpa, namhyung, acme, tglx,
linux-kernel
Commit-ID: 4f1fd74283582f3f5c34d1c9ed55117d775b4a20
Gitweb: http://git.kernel.org/tip/4f1fd74283582f3f5c34d1c9ed55117d775b4a20
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Sat, 17 Jun 2017 12:46:37 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 19 Jun 2017 22:05:54 -0300
perf config: Check error cases of {show_spec, set}_config()
show_spec_config() and set_config() can be called multiple times
in the loop in cmd_config().
However, The error cases of them wasn't checked, so fix it.
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1497671197-20450-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-config.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 7545966..bb1be79 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -225,10 +225,23 @@ int cmd_config(int argc, const char **argv)
break;
}
- if (value == NULL)
+ if (value == NULL) {
ret = show_spec_config(set, var);
- else
+ if (ret < 0) {
+ pr_err("%s is not configured: %s\n",
+ var, config_filename);
+ free(arg);
+ break;
+ }
+ } else {
ret = set_config(set, config_filename, var, value);
+ if (ret < 0) {
+ pr_err("Failed to set '%s=%s' on %s\n",
+ var, value, config_filename);
+ free(arg);
+ break;
+ }
+ }
free(arg);
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-20 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-17 3:46 [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config() Taeung Song
2017-06-19 18:32 ` Arnaldo Carvalho de Melo
2017-06-20 9:07 ` [tip:perf/core] " tip-bot for Taeung Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox