Re: [PATCH 1/1] brd: remove a redundant check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2020/4/22 9:28, Zhen Lei wrote:
> Because pages[i] can't be NULL, otherwise "pos = pages[i]->index;" will
> panic. So when "ret" is NULL, it can't be equal to pages[i].

In fact, "ret != pages[i]" is clear enough.

> 
> Signed-off-by: Zhen Lei <thunder.leizhen@xxxxxxxxxx>
> ---
>  drivers/block/brd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 2fb25c348d53..59fec4a8ac93 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -147,7 +147,7 @@ static void brd_free_pages(struct brd_device *brd)
>  			BUG_ON(pages[i]->index < pos);
>  			pos = pages[i]->index;
>  			ret = radix_tree_delete(&brd->brd_pages, pos);
> -			BUG_ON(!ret || ret != pages[i]);
> +			BUG_ON(ret != pages[i]);
>  			__free_page(pages[i]);
>  		}
>  
> 




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux