public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [3.13 PATCH 0/2] random: bytes vs. bits
@ 2013-12-07  2:27 Greg Price
  2013-12-07  2:27 ` [3.13 PATCH 1/2] random: entropy_bytes is actually bits Greg Price
  2013-12-07  2:28 ` [PATCH 2/2] random: clarify bits/bytes in wakeup thresholds Greg Price
  0 siblings, 2 replies; 5+ messages in thread
From: Greg Price @ 2013-12-07  2:27 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-07 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07  2:27 [3.13 PATCH 0/2] random: bytes vs. bits Greg Price
2013-12-07  2:27 ` [3.13 PATCH 1/2] random: entropy_bytes is actually bits Greg Price
2013-12-07 14:50   ` Theodore Ts'o
2013-12-07  2:28 ` [PATCH 2/2] random: clarify bits/bytes in wakeup thresholds Greg Price
2013-12-07 19:20   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox