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

guoren
2025-03-25T12:25:40Z

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 --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]);
--
2.40.1