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: <20200429072629.GE11410@infradead.org>
Date:   Wed, 29 Apr 2020 00:26:29 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Zou Wei <zou_wei@...wei.com>
Cc:     axboe@...nel.dk, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] blk-mq: Use BUG_ON() instead of BUG()

On Wed, Apr 29, 2020 at 10:10:24AM +0800, Zou Wei wrote:
> Fixes coccicheck warning:
> 
>  block/blk-mq.c:546:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
> 
> Fixes: 63151a449eba ("blk-mq: allow drivers to hook into I/O completion")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Zou Wei <zou_wei@...wei.com>
> ---
>  block/blk-mq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index bcc3a23..49a227e 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -542,8 +542,7 @@ EXPORT_SYMBOL(__blk_mq_end_request);
>  
>  void blk_mq_end_request(struct request *rq, blk_status_t error)
>  {
> -	if (blk_update_request(rq, error, blk_rq_bytes(rq)))
> -		BUG();
> +	BUG_ON(blk_update_request(rq, error, blk_rq_bytes(rq)));

I don't think hiding something that actually does do the work in a
BUG_ON ever is a good style.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ