Skip to contentSkip to conversation

random: remove dead code left over from blocking pool

PATCH RESEND In review Eric Biggers 2 participants 2 messages Mar 22, 2021 – Apr 2, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 random: remove dead code left over from blocking pool

From: Eric Biggers <[email protected]>

Remove some dead code that was left over following commit 90ea1c6436d2 ("random: remove the blocking pool").

---
 drivers/char/random.c         | 17 ++-----
 include/trace/events/random.h | 83 -----------------------------------
 2 files changed, 3 insertions(+), 97 deletions(-)
drivers/char/random.c +3 -14
index 5d6acfecd919b..605969ed0f965 100644
@@ -500,7 +500,6 @@ struct entropy_store {
 	unsigned short add_ptr;
 	unsigned short input_rotate;
 	int entropy_count;
-	unsigned int initialized:1;
 	unsigned int last_data_init:1;
 	__u8 last_data[EXTRACT_SIZE];
 };
@@ -660,7 +659,7 @@ static void process_random_ready_list(void)
  */
 static void credit_entropy_bits(struct entropy_store *r, int nbits)
 {
-	int entropy_count, orig, has_initialized = 0;
+	int entropy_count, orig;
 	const int pool_size = r->poolinfo->poolfracbits;
 	int nfrac = nbits << ENTROPY_SHIFT;
 
@@ -717,23 +716,14 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits)
 	if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
 		goto retry;
 
-	if (has_initialized) {
-		r->initialized = 1;
-		kill_fasync(&fasync, SIGIO, POLL_IN);
-	}
-
 	trace_credit_entropy_bits(r->name, nbits,
 				  entropy_count >> ENTROPY_SHIFT, _RET_IP_);
 
 	if (r == &input_pool) {
 		int entropy_bits = entropy_count >> ENTROPY_SHIFT;
 
-		if (crng_init < 2) {
-			if (entropy_bits < 128)
-				return;
+		if (crng_init < 2 && entropy_bits >= 128)
 			crng_reseed(&primary_crng, r);
-			entropy_bits = ENTROPY_BITS(r);
-		}
 	}
 }
 
@@ -1372,8 +1362,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
 }
 
 /*
- * This function does the actual extraction for extract_entropy and
- * extract_entropy_user.
+ * This function does the actual extraction for extract_entropy.
  *
  * Note: we assume that .poolwords is a multiple of 16 words.
  */
include/trace/events/random.h +0 -83

101 lines not on this page · raw message

Signature · 1 line
2.31.0
maintainer
#1 lore raw
Quoted 12 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Remove some dead code that was left over following commit 90ea1c6436d2 ("random: remove the blocking pool").

Quoted 4 lines

---
drivers/char/random.c | 17 ++-----
include/trace/events/random.h | 83 -----------------------------------

2 files changed, 3 insertions(+), 97 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt