lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH linux-next] fs/ext4: use BUG_ON instead of if condition followed by BUG
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
>

\
 
 \ /
  Last update: 2021-12-20 11:25    [W:0.178 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site