Home
last modified time | relevance | path

Searched hist:"0 fb7a01af5b0cbe5bf365891fc4d186f2caa23f7" (Results 1 – 1 of 1) sorted by relevance

/linux/drivers/char/
H A Drandom.cdiff 0fb7a01af5b0cbe5bf365891fc4d186f2caa23f7 Fri Dec 06 01:32:19 CET 2013 Greg Price <price@MIT.EDU> random: simplify accounting code

With this we handle "reserved" in just one place. As a bonus the
code becomes less nested, and the "wakeup_write" flag variable
becomes unnecessary. The variable "flags" was already unused.

This code behaves identically to the previous version except in
two pathological cases that don't occur. If the argument "nbytes"
is already less than "min", then we didn't previously enforce
"min". If r->limit is false while "reserved" is nonzero, then we
previously applied "reserved" in checking whether we had enough
bits, even though we don't apply it to actually limit how many we
take. The callers of account() never exercise either of these cases.

Before the previous commit, it was possible for "nbytes" to be less
than "min" if userspace chose a pathological configuration, but no
longer.

Cc: Jiri Kosina <jkosina@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Greg Price <price@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>