linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] random: remove unused get_random_var_wait functions
@ 2025-11-02  4:19 Eric Biggers
  2025-11-02 12:40 ` Jason A. Donenfeld
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2025-11-02  4:19 UTC (permalink / raw)
  To: Jason A . Donenfeld, Theodore Ts'o
  Cc: linux-kernel, linux-crypto, 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.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 include/linux/random.h | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/include/linux/random.h b/include/linux/random.h
index 333cecfca93f..8a8064dc3970 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -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
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] random: remove unused get_random_var_wait functions
  2025-11-02  4:19 [PATCH] random: remove unused get_random_var_wait functions Eric Biggers
@ 2025-11-02 12:40 ` Jason A. Donenfeld
  0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2025-11-02 12:40 UTC (permalink / raw)
  To: Eric Biggers; +Cc: Theodore Ts'o, linux-kernel, linux-crypto

On Sat, Nov 01, 2025 at 09:19:41PM -0700, Eric Biggers wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-02 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-02  4:19 [PATCH] random: remove unused get_random_var_wait functions Eric Biggers
2025-11-02 12:40 ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).