diff options
author | Frank Sorenson <sorenson@redhat.com> | 2016-06-27 15:17:19 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-07-19 16:23:26 -0400 |
commit | 34ae685cb3ac965c0c733c866412f3b66ddd64e7 (patch) | |
tree | ce1d56ca2e49e51d685a443ac8ea036a818e60c9 /drivers/mfd/smsc-ece1099.c | |
parent | b224f7cb635f0a1a0a80c1dae93699a2a1161604 (diff) | |
download | linux-34ae685cb3ac965c0c733c866412f3b66ddd64e7.tar.bz2 |
sunrpc: Fix bit count when setting hashtable size to power-of-two
Author: Frank Sorenson <sorenson@redhat.com>
Date: 2016-06-27 13:55:48 -0500
sunrpc: Fix bit count when setting hashtable size to power-of-two
The hashtable size is incorrectly calculated as the next higher
power-of-two when being set to a power-of-two. fls() returns the
bit number of the most significant set bit, with the least
significant bit being numbered '1'. For a power-of-two, fls()
will return a bit number which is one higher than the number of bits
required, leading to a hashtable which is twice the requested size.
In addition, the value of (1 << nbits) will always be at least num,
so the test will never be true.
Fix the hash table size calculation to correctly set hashtable
size, and eliminate the unnecessary check.
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'drivers/mfd/smsc-ece1099.c')
0 files changed, 0 insertions, 0 deletions