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] [day] [month] [year] [list]
Message-ID: <20220706073228.GA671288@louislifei-OptiPlex-7090>
Date:   Wed, 6 Jul 2022 15:32:28 +0800
From:   Li Fei1 <fei1.li@...el.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org
Subject: Re: [PATCH -next] virt: acrn: using for_each_set_bit to simplify the
 code

On Mon, Jul 04, 2022 at 08:50:44PM +0800, Yang Yingliang wrote:
> It's more cleanly to use for_each_set_bit() instead of opencoding it.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>

Signed-off-by: Fei Li <fei1.li@...el.com>

Thanks.

> ---
>  drivers/virt/acrn/ioreq.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/virt/acrn/ioreq.c b/drivers/virt/acrn/ioreq.c
> index 5ff1c53740c0..d75ab3f66da4 100644
> --- a/drivers/virt/acrn/ioreq.c
> +++ b/drivers/virt/acrn/ioreq.c
> @@ -246,12 +246,8 @@ void acrn_ioreq_request_clear(struct acrn_vm *vm)
>  	spin_lock_bh(&vm->ioreq_clients_lock);
>  	client = vm->default_client;
>  	if (client) {
> -		vcpu = find_first_bit(client->ioreqs_map, ACRN_IO_REQUEST_MAX);
> -		while (vcpu < ACRN_IO_REQUEST_MAX) {
> +		for_each_set_bit(vcpu, client->ioreqs_map, ACRN_IO_REQUEST_MAX)
>  			acrn_ioreq_complete_request(client, vcpu, NULL);
> -			vcpu = find_next_bit(client->ioreqs_map,
> -					     ACRN_IO_REQUEST_MAX, vcpu + 1);
> -		}
>  	}
>  	spin_unlock_bh(&vm->ioreq_clients_lock);
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ