UPSTREAM: random: convert to ENTROPY_BITS for better code readability
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Link: https://lore.kernel.org/r/20190607182517.28266-2-tiny.windzz@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> (cherry picked from commit 12faac30d157970fdbfa171bbeb1fb88350303b1) Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 148665638 Change-Id: If96c7d9b69618ec879f1de1565cff0ac057ffe84
This commit is contained in:
parent
97145ad76d
commit
d3df0392b7
1 changed files with 2 additions and 3 deletions
|
@ -760,7 +760,7 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits)
|
||||||
if (entropy_bits < 128)
|
if (entropy_bits < 128)
|
||||||
return;
|
return;
|
||||||
crng_reseed(&primary_crng, r);
|
crng_reseed(&primary_crng, r);
|
||||||
entropy_bits = r->entropy_count >> ENTROPY_SHIFT;
|
entropy_bits = ENTROPY_BITS(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1378,8 +1378,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
trace_debit_entropy(r->name, 8 * ibytes);
|
trace_debit_entropy(r->name, 8 * ibytes);
|
||||||
if (ibytes &&
|
if (ibytes && ENTROPY_BITS(r) < random_write_wakeup_bits) {
|
||||||
(r->entropy_count >> ENTROPY_SHIFT) < random_write_wakeup_bits) {
|
|
||||||
wake_up_interruptible(&random_write_wait);
|
wake_up_interruptible(&random_write_wait);
|
||||||
kill_fasync(&fasync, SIGIO, POLL_OUT);
|
kill_fasync(&fasync, SIGIO, POLL_OUT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue