Skip to contentSkip to conversation

powerpc/archrandom: fix arch_get_random_seed_int()

PATCH Applied Ard Biesheuvel 2 participants 2 messages Dec 4, 2019 – Dec 9, 2019 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/archrandom: fix arch_get_random_seed_int()

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_*")
---
 arch/powerpc/include/asm/archrandom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/archrandom.h +1 -1
index 9c63b596e6ce..a09595f00cab 100644
@@ -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;
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Ard Biesheuvel

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.

Quoted 5 lines

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_*")

Applied to powerpc fixes, thanks.

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

cheers