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]
Date:	Tue, 20 May 2014 09:56:49 -0700
From:	Joe Perches <joe@...ches.com>
To:	Fabian Frederick <fabf@...net.be>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>, jack <jack@...e.cz>,
	akpm <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/1] fs/jbd/revoke.c: replace shift loop by ilog2

On Tue, 2014-05-20 at 18:50 +0200, Fabian Frederick wrote:
> journal_init_revoke_table is only called with positive hash_size
> (JOURNAL_REVOKE_DEFAULT_HASH) so we can replace loop shift by ilog2

This commit message is lacking something like:

Also replace index variable tmp with the more commonly used i.

> diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c
[]
> @@ -231,19 +231,15 @@ record_cache_failure:
>  
>  static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size)
>  {
> -	int shift = 0;
> -	int tmp = hash_size;
> +	int i;
>  	struct jbd_revoke_table_s *table;
>  
>  	table = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL);
>  	if (!table)
>  		goto out;
>  
> -	while((tmp >>= 1UL) != 0UL)
> -		shift++;
> -
>  	table->hash_size = hash_size;
> -	table->hash_shift = shift;
> +	table->hash_shift = ilog2(hash_size);
>  	table->hash_table =
>  		kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL);
>  	if (!table->hash_table) {
> @@ -252,8 +248,8 @@ static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size)
>  		goto out;
>  	}
>  
> -	for (tmp = 0; tmp < hash_size; tmp++)
> -		INIT_LIST_HEAD(&table->hash_table[tmp]);
> +	for (i = 0; i < hash_size; i++)
> +		INIT_LIST_HEAD(&table->hash_table[i]);
>  
>  out:
>  	return table;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ