mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: David Laight <david.laight.linux@gmail.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Kir Chou <note351@hotmail.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Mark Rutland <mark.rutland@arm.com>, Kees Cook <kees@kernel.org>
Subject: [PATCH next 4/7] random32: Change prandom_seed_state() to be a real function
Date: Mon,  2 Nov 2026 20:05:19 +0000	[thread overview]
Message-ID: <20261102200522.3337-5-david.laight.linux@gmail.com> (raw)
In-Reply-To: <20261102200522.3337-1-david.laight.linux@gmail.com>

There is no reason for it to be inlined.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
 include/linux/prandom.h | 10 +---------
 lib/random32.c          | 11 +++++++++++
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/include/linux/prandom.h b/include/linux/prandom.h
index ff7dcc3fa105..d4627e62098c 100644
--- a/include/linux/prandom.h
+++ b/include/linux/prandom.h
@@ -37,14 +37,6 @@ static inline u32 __seed(u32 x, u32 m)
  * @state: pointer to state structure to receive the seed.
  * @seed: arbitrary 64-bit value to use as a seed.
  */
-static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
-{
-	u32 i = ((seed >> 32) ^ (seed << 10) ^ seed) & 0xffffffffUL;
-
-	state->s1 = __seed(i,   2U);
-	state->s2 = __seed(i,   8U);
-	state->s3 = __seed(i,  16U);
-	state->s4 = __seed(i, 128U);
-}
+void prandom_seed_state(struct rnd_state *state, u64 seed);
 
 #endif
diff --git a/lib/random32.c b/lib/random32.c
index 53cb289a5db4..83776345adda 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -130,3 +130,14 @@ void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state)
 	}
 }
 EXPORT_SYMBOL(prandom_seed_full_state);
+
+void prandom_seed_state(struct rnd_state *state, u64 seed)
+{
+	u32 i = ((seed >> 32) ^ (seed << 10) ^ seed) & 0xffffffffUL;
+
+	state->s1 = __seed(i,   2U);
+	state->s2 = __seed(i,   8U);
+	state->s3 = __seed(i,  16U);
+	state->s4 = __seed(i, 128U);
+}
+EXPORT_SYMBOL(prandom_seed_state);
-- 
2.39.5


  parent reply	other threads:[~2026-11-02 20:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 20:05 [PATCH next 0/7] random32: Improve security and simplify keying David Laight
2026-11-02 20:05 ` [PATCH next 1/7] random32: Improve security of prandom_u32_state() David Laight
2026-11-02 20:05 ` [PATCH next 2/7] random32: Remove some unnecessary #includes David Laight
2026-11-02 20:05 ` [PATCH next 3/7] random32: Fix tests for xor -> add change to prandom_u32_state() David Laight
2026-11-02 20:05 ` David Laight [this message]
2026-11-02 20:05 ` [PATCH next 5/7] random32: Use add (not xor) in tools prandom_u32_state() David Laight
2026-11-02 20:05 ` [PATCH next 6/7] random32: prandom_seed_state() use all 64 bits of the seed David Laight
2026-11-02 20:05 ` [PATCH next 7/7] random32: Simplify prandom_seed_full_state() David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102200522.3337-5-david.laight.linux@gmail.com \
    --to=david.laight.linux@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=note351@hotmail.com \
    --cc=ryan.roberts@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®