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: <5567bcc4-08e4-9fae-df1d-10bda50efef4@huawei.com>
Date: Wed, 31 Jul 2024 20:08:24 +0800
From: Zhang Yi <yi.zhang@...wei.com>
To: Kemeng Shi <shikemeng@...weicloud.com>
CC: <linux-ext4@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<tytso@....edu>, <jack@...e.com>
Subject: Re: [PATCH v3 8/8] jbd2: remove unneeded check of ret in
 jbd2_fc_get_buf

On 2024/7/31 17:29, Kemeng Shi wrote:
> Simply return -EINVAL if j_fc_off is invalid to avoid repeated check of
> ret.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> Reviewed-by: Jan Kara <jack@...e.cz>

Thanks, looks good to me.

Reviewed-by: Zhang Yi <yi.zhang@...wei.com>

> ---
>  fs/jbd2/journal.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e89d777ded34..c5179aa38111 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -837,17 +837,12 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
>  
>  	*bh_out = NULL;
>  
> -	if (journal->j_fc_off + journal->j_fc_first < journal->j_fc_last) {
> -		fc_off = journal->j_fc_off;
> -		blocknr = journal->j_fc_first + fc_off;
> -		journal->j_fc_off++;
> -	} else {
> -		ret = -EINVAL;
> -	}
> -
> -	if (ret)
> -		return ret;
> +	if (journal->j_fc_off + journal->j_fc_first >= journal->j_fc_last)
> +		return -EINVAL;
>  
> +	fc_off = journal->j_fc_off;
> +	blocknr = journal->j_fc_first + fc_off;
> +	journal->j_fc_off++;
>  	ret = jbd2_journal_bmap(journal, blocknr, &pblock);
>  	if (ret)
>  		return ret;
> @@ -856,7 +851,6 @@ int jbd2_fc_get_buf(journal_t *journal, struct buffer_head **bh_out)
>  	if (!bh)
>  		return -ENOMEM;
>  
> -
>  	journal->j_fc_wbuf[fc_off] = bh;
>  
>  	*bh_out = bh;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ