mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
perf llvm: Return -ENOMEM when asprintf() fails
[ Upstream commit c435c166dcf526ac827bc964d82cc0d5e7a1fd0b ] Zhihao sent a patch but it made llvm__compile_bpf() return what asprintf() returns on error, which is just -1, but since this function returns -errno, fix it by returning -ENOMEM for this case instead. Fixes:cb76371441("perf llvm: Allow passing options to llc ...") Fixes:5eab5a7ee0("perf llvm: Display eBPF compiling command ...") Reported-by: Hulk Robot <[email protected]> Reported-by: Zhihao Cheng <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Yu Kuai <[email protected]> Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
b00da826ca
commit
00d38f7031
1 changed files with 2 additions and 0 deletions
|
|
@ -502,6 +502,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf,
|
|||
goto errout;
|
||||
}
|
||||
|
||||
err = -ENOMEM;
|
||||
if (asprintf(&pipe_template, "%s -emit-llvm | %s -march=bpf %s -filetype=obj -o -",
|
||||
template, llc_path, opts) < 0) {
|
||||
pr_err("ERROR:\tnot enough memory to setup command line\n");
|
||||
|
|
@ -522,6 +523,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf,
|
|||
|
||||
pr_debug("llvm compiling command template: %s\n", template);
|
||||
|
||||
err = -ENOMEM;
|
||||
if (asprintf(&command_echo, "echo -n \"%s\"", template) < 0)
|
||||
goto errout;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue