diff mbox series

[RFC,V3,37/43] rv64ilp32_abi: random: Adapt fast_pool struct

Message ID 20250325121624.523258-38-guoren@kernel.org (mailing list archive)
State New
Headers show
Series rv64ilp32_abi: Build CONFIG_64BIT kernel-self with ILP32 ABI | expand

Commit Message

Guo Ren March 25, 2025, 12:16 p.m. UTC
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>

RV64ILP32 ABI systems have BITS_PER_LONG set to 32, matching
sizeof(compat_ulong_t). Adjust code

Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
 drivers/char/random.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 2581186fa61b..0bfbe02ee255 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1015,7 +1015,11 @@  EXPORT_SYMBOL_GPL(unregister_random_vmfork_notifier);
 #endif
 
 struct fast_pool {
+#ifdef CONFIG_64BIT
+	u64 pool[4];
+#else
 	unsigned long pool[4];
+#endif
 	unsigned long last;
 	unsigned int count;
 	struct timer_list mix;
@@ -1040,7 +1044,11 @@  static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = {
  * and therefore this has no security on its own. s represents the
  * four-word SipHash state, while v represents a two-word input.
  */
+#ifdef CONFIG_64BIT
+static void fast_mix(u64 s[4], u64 v1, u64 v2)
+#else
 static void fast_mix(unsigned long s[4], unsigned long v1, unsigned long v2)
+#endif
 {
 	s[3] ^= v1;
 	FASTMIX_PERM(s[0], s[1], s[2], s[3]);