diff mbox

[net-next] rhashtable: ensure that ht->p.min_size is round up to the power of two

Message ID 1426839237-10345-1-git-send-email-rongqing.li@windriver.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

li qongqing March 20, 2015, 8:13 a.m. UTC
From: Li RongQing <roy.qing.li@gmail.com>

ht->p.min_size will be reset to params->min_size, which has been set
to the params->min_size round up of the power of two, should be kept

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Cc: Thomas Graf <tgraf@suug.ch>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 lib/rhashtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu March 20, 2015, 8:49 a.m. UTC | #1
On Fri, Mar 20, 2015 at 04:13:57PM +0800, rongqing.li@windriver.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> ht->p.min_size will be reset to params->min_size, which has been set
> to the params->min_size round up of the power of two, should be kept
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> Cc: Thomas Graf <tgraf@suug.ch>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>

Thanks for the patch but I've already fixed this in my tree which
I will post soon and I'd like to avoid having to rebase it yet
again for something as trivial as this.
diff mbox

Patch

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index e75c48d..fda169b 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -946,7 +946,7 @@  int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
 	if (params->max_size)
 		ht->p.max_size = rounddown_pow_of_two(params->max_size);
 
-	ht->p.min_size = max(params->min_size, HASH_MIN_SIZE);
+	ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE);
 
 	if (params->locks_mul)
 		ht->p.locks_mul = roundup_pow_of_two(params->locks_mul);