Skip to content

Commit 8b2d953

Browse files
committed
random: remove unused extract_entropy() reserved argument
This argument is always set to zero, as a result of us not caring about keeping a certain amount reserved in the pool these days. So just remove it and cleanup the function signatures. Reviewed-by: Dominik Brodowski <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent a4bfa9b commit 8b2d953

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

drivers/char/random.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ struct entropy_store {
519519
};
520520

521521
static ssize_t extract_entropy(struct entropy_store *r, void *buf,
522-
size_t nbytes, int min, int rsvd);
522+
size_t nbytes, int min);
523523
static ssize_t _extract_entropy(struct entropy_store *r, void *buf,
524524
size_t nbytes);
525525

@@ -989,7 +989,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
989989
} buf;
990990

991991
if (r) {
992-
num = extract_entropy(r, &buf, 32, 16, 0);
992+
num = extract_entropy(r, &buf, 32, 16);
993993
if (num == 0)
994994
return;
995995
} else {
@@ -1327,8 +1327,7 @@ EXPORT_SYMBOL_GPL(add_disk_randomness);
13271327
* This function decides how many bytes to actually take from the
13281328
* given pool, and also debits the entropy count accordingly.
13291329
*/
1330-
static size_t account(struct entropy_store *r, size_t nbytes, int min,
1331-
int reserved)
1330+
static size_t account(struct entropy_store *r, size_t nbytes, int min)
13321331
{
13331332
int entropy_count, orig, have_bytes;
13341333
size_t ibytes, nfrac;
@@ -1342,7 +1341,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
13421341
/* never pull more than available */
13431342
have_bytes = entropy_count >> (ENTROPY_SHIFT + 3);
13441343

1345-
if ((have_bytes -= reserved) < 0)
1344+
if (have_bytes < 0)
13461345
have_bytes = 0;
13471346
ibytes = min_t(size_t, ibytes, have_bytes);
13481347
if (ibytes < min)
@@ -1448,15 +1447,13 @@ static ssize_t _extract_entropy(struct entropy_store *r, void *buf,
14481447
* returns it in a buffer.
14491448
*
14501449
* The min parameter specifies the minimum amount we can pull before
1451-
* failing to avoid races that defeat catastrophic reseeding while the
1452-
* reserved parameter indicates how much entropy we must leave in the
1453-
* pool after each pull to avoid starving other readers.
1450+
* failing to avoid races that defeat catastrophic reseeding.
14541451
*/
14551452
static ssize_t extract_entropy(struct entropy_store *r, void *buf,
1456-
size_t nbytes, int min, int reserved)
1453+
size_t nbytes, int min)
14571454
{
14581455
trace_extract_entropy(r->name, nbytes, ENTROPY_BITS(r), _RET_IP_);
1459-
nbytes = account(r, nbytes, min, reserved);
1456+
nbytes = account(r, nbytes, min);
14601457
return _extract_entropy(r, buf, nbytes);
14611458
}
14621459

0 commit comments

Comments
 (0)