Skip to contentSkip to conversation

random: remove unused get_random_var_wait functions

PATCH Applied Eric Biggers 2 participants 2 messages Nov 2, 2025

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

PATCH 1/1 random: remove unused get_random_var_wait functions

None of these functions are used, so remove them.

This renders the two bugs moot:

- get_random_u64_wait() used the wrong pointer type, making it provide only 32 bits.

- The '#undef' directive used the wrong identifier, leaving the helper macro defined.

---
 include/linux/random.h | 15 ---------------
 1 file changed, 15 deletions(-)
include/linux/random.h +0 -15
index 333cecfca93f..8a8064dc3970 100644
@@ -128,25 +128,10 @@ static inline int get_random_bytes_wait(void *buf, size_t nbytes)
 	int ret = wait_for_random_bytes();
 	get_random_bytes(buf, nbytes);
 	return ret;
 }
 
-#define declare_get_random_var_wait(name, ret_type) \
-	static inline int get_random_ ## name ## _wait(ret_type *out) { \
-		int ret = wait_for_random_bytes(); \
-		if (unlikely(ret)) \
-			return ret; \
-		*out = get_random_ ## name(); \
-		return 0; \
-	}
-declare_get_random_var_wait(u8, u8)
-declare_get_random_var_wait(u16, u16)
-declare_get_random_var_wait(u32, u32)
-declare_get_random_var_wait(u64, u32)
-declare_get_random_var_wait(long, unsigned long)
-#undef declare_get_random_var
-
 #ifdef CONFIG_SMP
 int random_prepare_cpu(unsigned int cpu);
 int random_online_cpu(unsigned int cpu);
 #endif
 

base-commit: 691d401c7e0e5ea34ac6f8151bc0696db1b2500a

Signature · 1 line
2.51.2
maintainer Applied
#1 lore raw
Quoted 9 lines · Eric Biggers

None of these functions are used, so remove them.

This renders the two bugs moot:

- get_random_u64_wait() used the wrong pointer type, making it provide only 32 bits.

- The '#undef' directive used the wrong identifier, leaving the helper macro defined.

Applied, thanks. And nice catch.

Jason