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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191004081215.GB13650@quack2.suse.cz>
Date:   Fri, 4 Oct 2019 10:12:15 +0200
From:   Jan Kara <jack@...e.cz>
To:     Chengguang Xu <cgxu519@...o.com.cn>
Cc:     Jan Kara <jack@...e.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] quota: code cleanup for hash bits calculation

On Mon 23-09-19 21:52:23, Chengguang Xu wrote:
> Code cleanup for hash bits calculation by
> calling ilog2().
> 
> Signed-off-by: Chengguang Xu <cgxu519@...o.com.cn>

Thanks! I've queued your patch.

								Honza

> ---
> v1->v2:
> - Calculate hash bits by directly calling ilog2().
> 
>  fs/quota/dquot.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 6e826b454082..fde1b94ea587 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2983,11 +2983,7 @@ static int __init dquot_init(void)
>  
>  	/* Find power-of-two hlist_heads which can fit into allocation */
>  	nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
> -	dq_hash_bits = 0;
> -	do {
> -		dq_hash_bits++;
> -	} while (nr_hash >> dq_hash_bits);
> -	dq_hash_bits--;
> +	dq_hash_bits = ilog2(nr_hash);
>  
>  	nr_hash = 1UL << dq_hash_bits;
>  	dq_hash_mask = nr_hash - 1;
> -- 
> 2.21.0
> 
> 
> 
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ