[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BBEB2EA2-0A6D-402C-B10B-F2EFB3CACD7F@fb.com>
Date: Thu, 12 May 2022 16:44:30 +0000
From: Song Liu <songliubraving@...com>
To: Wan Jiabing <wanjiabing@...o.com>
CC: Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] bpf: simplify if-if to if in
bpf_kprobe_multi_link_attach
> On May 12, 2022, at 7:17 AM, Wan Jiabing <wanjiabing@...o.com> wrote:
>
> Simplify double 'if' statements to one 'if' statement.
>
> Signed-off-by: Wan Jiabing <wanjiabing@...o.com>
> ---
> kernel/trace/bpf_trace.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 3a8b69ef9a0d..1b0db8f78dc8 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -2464,11 +2464,9 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
> if (!addrs)
> return -ENOMEM;
>
> - if (uaddrs) {
> - if (copy_from_user(addrs, uaddrs, size)) {
> - err = -EFAULT;
> - goto error_addrs;
> - }
> + if (uaddrs && copy_from_user(addrs, uaddrs, size)) {
> + err = -EFAULT;
> + goto error_addrs;
> } else {
> struct user_syms us;
This changed the behavior, no?
For uaddrs != NULL and copy_from_user() == 0 case, we now going into
else clause. Did I misread anything?
Song
Powered by blists - more mailing lists