Messages in this thread | | | Date | Fri, 6 Dec 2013 21:27:42 -0500 | From | Greg Price <> | Subject | [3.13 PATCH 0/2] random: bytes vs. bits |
| |
The new when-to-push logic in v3.13-rc1~61^2~6 "random: push extra entropy to the output pools" uses the name "entropy_bytes" for a quantity that's actually in bits. This results in confusing, buggy-looking lines both where the variable is set and where it's used. Fortunately it's all consistent if the variable is understood as counting bits, so the behavior is fine.
This code is new in v3.13-rc1, so fixing the name seems in order for 3.13. The first patch here just does that.
One cause of the mistake is probably that the names of random_read_wakeup_thresh and random_write_wakeup_thresh don't indicate what units they're in. This is an especially acute issue now that we have three units for entropy in different places -- bytes, bits, and 1 / (1 << ENTROPY_SHIFT) fractions of a bit. The second patch clarifies the units in both names. (Maybe other names should be clarified too.) This may as well be post-3.13.
Cheers, Greg
Greg Price (2): random: entropy_bytes is actually bits random: clarify bits/bytes in wakeup thresholds
drivers/char/random.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
-- 1.8.3.2
| |