public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: cgel.zte@gmail.com
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org,
	adilger.kernel@dilger.ca, linux-kernel@vger.kernel.org,
	xu xin <xu.xin16@zte.com.cn>, Zeal robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] fs/ext4: use BUG_ON instead of if condition followed by BUG
Date: Mon, 20 Dec 2021 11:24:21 +0100	[thread overview]
Message-ID: <20211220102421.sggplg54ncsafcpi@work> (raw)
In-Reply-To: <20211219130643.462943-1-xu.xin16@zte.com.cn>

On Sun, Dec 19, 2021 at 01:06:43PM +0000, cgel.zte@gmail.com wrote:
> From: xu xin <xu.xin16@zte.com.cn>
> 
> BUG_ON would be better.

Indeed. Thanks for the patch.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>


> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal robot <zealci@zte.com.cn>
> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> ---
>  fs/ext4/ext4.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 9cc55bcda6ba..00bc3f67d37f 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2400,8 +2400,7 @@ ext4_rec_len_from_disk(__le16 dlen, unsigned blocksize)
>  
>  static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
>  {
> -	if ((len > blocksize) || (blocksize > (1 << 18)) || (len & 3))
> -		BUG();
> +	BUG_ON((len > blocksize) || (blocksize > (1 << 18)) || (len & 3));
>  #if (PAGE_SIZE >= 65536)
>  	if (len < 65536)
>  		return cpu_to_le16(len);
> -- 
> 2.25.1
> 


  reply	other threads:[~2021-12-20 10:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-19 13:06 [PATCH linux-next] fs/ext4: use BUG_ON instead of if condition followed by BUG cgel.zte
2021-12-20 10:24 ` Lukas Czerner [this message]
2021-12-28  7:32   ` [PATCH resend] " cgel.zte
2022-01-05  5:35     ` riteshh
2022-01-05  6:22       ` cgel.zte
2022-01-05  8:36     ` [PATCH] ext4: Simplify !page_bufs logic with simple BUG_ON() Ritesh Harjani
2022-01-05  8:45       ` Lukas Czerner
2022-01-06  4:37       ` Theodore Ts'o
2022-01-06  4:41     ` [PATCH resend] fs/ext4: use BUG_ON instead of if condition followed by BUG Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211220102421.sggplg54ncsafcpi@work \
    --to=lczerner@redhat.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=cgel.zte@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xu.xin16@zte.com.cn \
    --cc=zealci@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox