Re: [PATCH 2/3] bpf: simplify if-if to if in bpf_kprobe_multi_link_attach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On May 12, 2022, at 7:17 AM, Wan Jiabing <wanjiabing@xxxxxxxx> wrote:
> 
> Simplify double 'if' statements to one 'if' statement.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@xxxxxxxx>
> ---
> 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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux