lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 Jan 2017 08:32:37 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     Adrian Hunter <adrian.hunter@...el.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        He Kuang <hekuang@...wei.com>, Ingo Molnar <mingo@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Milian Wolff <milian.wolff@...b.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>,
        Wang Nan <wangnan0@...wei.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 4/4] perf strlist: Move an error code assignment in
 strlist__parse_list_entry()

On Mon, 23 Jan 2017 16:26:24 +0100
SF Markus Elfring <elfring@...rs.sourceforge.net> wrote:

> From: Markus Elfring <elfring@...rs.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@...nel.org>

Thanks!

> 
> Signed-off-by: Markus Elfring <elfring@...rs.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@...nel.org>

Powered by blists - more mailing lists