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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220912183730.5890cbbc5c062145c07a577a@kernel.org>
Date:   Mon, 12 Sep 2022 18:37:30 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.org>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     <linux-kernel@...r.kernel.org>, <mhiramat@...nel.org>,
        <ast@...nel.org>, <jbacik@...com>, <akpm@...ux-foundation.org>
Subject: Re: [PATCH -next 2/3] fail_function: refctor code of checking
 return value of register_kprobe()

On Fri, 26 Aug 2022 15:33:36 +0800
Yang Yingliang <yangyingliang@...wei.com> wrote:

> Refactor the error handling of register_kprobe() to improve readability.
> No functional change.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>

OK, but in this case, could you fold [2/3] and [3/3], because
[3/3] can not be applied without this change.

Thank you,

> ---
>  kernel/fail_function.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/fail_function.c b/kernel/fail_function.c
> index 03643e33e4c3..893e8f9a9118 100644
> --- a/kernel/fail_function.c
> +++ b/kernel/fail_function.c
> @@ -294,14 +294,13 @@ static ssize_t fei_write(struct file *file, const char __user *buffer,
>  	}
>  
>  	ret = register_kprobe(&attr->kp);
> -	if (!ret)
> -		fei_debugfs_add_attr(attr);
> -	if (ret < 0)
> +	if (ret) {
>  		fei_attr_remove(attr);
> -	else {
> -		list_add_tail(&attr->list, &fei_attr_list);
> -		ret = count;
> +		goto out;
>  	}
> +	fei_debugfs_add_attr(attr);
> +	list_add_tail(&attr->list, &fei_attr_list);
> +	ret = count;
>  out:
>  	mutex_unlock(&fei_lock);
>  	kfree(buf);
> -- 
> 2.25.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ