Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1565060 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-01-23 16:30 +0100 |
| Last post | 2017-01-24 00:40 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4] perf: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-23 16:30 +0100
[PATCH 4/4] perf strlist: Move an error code assignment in strlist__parse_list_entry() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-23 16:30 +0100
Re: [PATCH 4/4] perf strlist: Move an error code assignment in strlist__parse_list_entry() Masami Hiramatsu <mhiramat@kernel.org> - 2017-01-24 00:40 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-23 16:30 +0100 |
| Subject | [PATCH 0/4] perf: Fine-tuning for three function implementations |
| Message-ID | <t2OJc-885-21@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 23 Jan 2017 16:08:21 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (4): Delete an unnecessary check in try_to_find_absolute_address() Delete an unnecessary assignment in try_to_find_absolute_address() Move an error code assignment in __perf_session__set_tracepoints_handlers() Move an error code assignment in strlist__parse_list_entry() tools/perf/util/probe-event.c | 11 ++++------- tools/perf/util/session.c | 6 +++--- tools/perf/util/strlist.c | 5 +++-- 3 files changed, 10 insertions(+), 12 deletions(-) -- 2.11.0
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-23 16:30 +0100 |
| Subject | [PATCH 4/4] perf strlist: Move an error code assignment in strlist__parse_list_entry() |
| Message-ID | <t2OJd-885-35@gated-at.bofh.it> |
| In reply to | #1565060 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 23 Jan 2017 15:56:31 +0100
A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
tools/perf/util/strlist.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index 0d3dfcb919b4..a934be385a6d 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -118,9 +118,10 @@ static int strlist__parse_list_entry(struct strlist *slist, const char *s,
return strlist__load(slist, s + 7);
if (subst_dir) {
- err = -ENOMEM;
- if (asprintf(&subst, "%s/%s", subst_dir, s) < 0)
+ if (asprintf(&subst, "%s/%s", subst_dir, s) < 0) {
+ err = -ENOMEM;
goto out;
+ }
if (access(subst, F_OK) == 0) {
err = strlist__load(slist, subst);
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Date | 2017-01-24 00:40 +0100 |
| Subject | Re: [PATCH 4/4] perf strlist: Move an error code assignment in strlist__parse_list_entry() |
| Message-ID | <t2Wno-4ES-7@gated-at.bofh.it> |
| In reply to | #1565062 |
On Mon, 23 Jan 2017 16:26:24 +0100
SF Markus Elfring <elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 23 Jan 2017 15:56:31 +0100
>
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignment into an if branch
> to indicate a software failure there.
>
> This issue was detected by using the Coccinelle software.
Looks good to me.
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks!
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> tools/perf/util/strlist.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
> index 0d3dfcb919b4..a934be385a6d 100644
> --- a/tools/perf/util/strlist.c
> +++ b/tools/perf/util/strlist.c
> @@ -118,9 +118,10 @@ static int strlist__parse_list_entry(struct strlist *slist, const char *s,
> return strlist__load(slist, s + 7);
>
> if (subst_dir) {
> - err = -ENOMEM;
> - if (asprintf(&subst, "%s/%s", subst_dir, s) < 0)
> + if (asprintf(&subst, "%s/%s", subst_dir, s) < 0) {
> + err = -ENOMEM;
> goto out;
> + }
>
> if (access(subst, F_OK) == 0) {
> err = strlist__load(slist, subst);
> --
> 2.11.0
>
--
Masami Hiramatsu <mhiramat@kernel.org>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web