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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210609115945.2193194-1-chengzhihao1@huawei.com>
Date:   Wed, 9 Jun 2021 19:59:45 +0800
From:   Zhihao Cheng <chengzhihao1@...wei.com>
To:     <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
        <jolsa@...hat.com>, <ast@...nel.org>, <daniel@...earbox.net>,
        <andrii@...nel.org>, <nathan@...nel.org>, <ndesaulniers@...gle.com>
CC:     <linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
        <clang-built-linux@...glegroups.com>, <chengzhihao1@...wei.com>,
        <yukuai3@...wei.com>
Subject: [PATCH] perf llvm: Fix error return code in llvm__compile_bpf()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: cb76371441d098 ("perf llvm: Allow passing options to llc ...")
Fixes: 5eab5a7ee032ac ("perf llvm: Display eBPF compiling command ...")
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@...wei.com>
---
 tools/perf/util/llvm-utils.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c
index 3ceaf7ef3301..2de02639fb67 100644
--- a/tools/perf/util/llvm-utils.c
+++ b/tools/perf/util/llvm-utils.c
@@ -504,8 +504,9 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf,
 			goto errout;
 		}
 
-		if (asprintf(&pipe_template, "%s -emit-llvm | %s -march=bpf %s -filetype=obj -o -",
-			      template, llc_path, opts) < 0) {
+		err = asprintf(&pipe_template, "%s -emit-llvm | %s -march=bpf %s -filetype=obj -o -",
+			       template, llc_path, opts);
+		if (err < 0) {
 			pr_err("ERROR:\tnot enough memory to setup command line\n");
 			goto errout;
 		}
@@ -524,7 +525,8 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf,
 
 	pr_debug("llvm compiling command template: %s\n", template);
 
-	if (asprintf(&command_echo, "echo -n \"%s\"", template) < 0)
+	err = asprintf(&command_echo, "echo -n \"%s\"", template);
+	if (err < 0)
 		goto errout;
 
 	err = read_from_pipe(command_echo, (void **) &command_out, NULL);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ