diff mbox series

powerpc/archrandom: fix arch_get_random_seed_int()

Message ID 20191204115015.18015-1-ardb@kernel.org (mailing list archive)
State Accepted
Headers show
Series powerpc/archrandom: fix arch_get_random_seed_int() | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (2e6c4d7e1c5990fa2ccca6db0868a05640ac1df1)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch fail total: 1 errors, 1 warnings, 0 checks, 8 lines checked
snowpatch_ozlabs/needsstable warning Please consider tagging this patch for stable!

Commit Message

Ard Biesheuvel Dec. 4, 2019, 11:50 a.m. UTC
Commit 01c9348c7620ec65

  powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_*

updated arch_get_random_[int|long]() to be NOPs, and moved the hardware
RNG backing to arch_get_random_seed_[int|long]() instead. However, it
failed to take into account that arch_get_random_int() was implemented
in terms of arch_get_random_long(), and so we ended up with a version
of the former that is essentially a NOP as well.

Fix this by calling arch_get_random_seed_long() from
arch_get_random_seed_int() instead.

Fixes: 01c9348c7620ec65 ("powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_*")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/powerpc/include/asm/archrandom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Ellerman Dec. 9, 2019, 5:45 a.m. UTC | #1
On Wed, 2019-12-04 at 11:50:15 UTC, Ard Biesheuvel wrote:
> Commit 01c9348c7620ec65
> 
>   powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_*
> 
> updated arch_get_random_[int|long]() to be NOPs, and moved the hardware
> RNG backing to arch_get_random_seed_[int|long]() instead. However, it
> failed to take into account that arch_get_random_int() was implemented
> in terms of arch_get_random_long(), and so we ended up with a version
> of the former that is essentially a NOP as well.
> 
> Fix this by calling arch_get_random_seed_long() from
> arch_get_random_seed_int() instead.
> 
> Fixes: 01c9348c7620ec65 ("powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_*")
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/b6afd1234cf93aa0d71b4be4788c47534905f0be

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h
index 9c63b596e6ce..a09595f00cab 100644
--- a/arch/powerpc/include/asm/archrandom.h
+++ b/arch/powerpc/include/asm/archrandom.h
@@ -28,7 +28,7 @@  static inline int arch_get_random_seed_int(unsigned int *v)
 	unsigned long val;
 	int rc;
 
-	rc = arch_get_random_long(&val);
+	rc = arch_get_random_seed_long(&val);
 	if (rc)
 		*v = val;