fault-inject: use prandom where cryptographically secure randomness is not needed
authorAkinobu Mita <akinobu.mita@gmail.com>
Sun, 8 Dec 2024 14:24:15 +0000 (23:24 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 13 Jan 2025 04:21:00 +0000 (20:21 -0800)
commite9bc360b105c2042db30c36ed1c5ca48dcc7f84b
treefcb289b53b70ab68c6fa7a2fdadeb30fa8186641
parent3735c5225b97cb57745afd151904d08847b09cc7
fault-inject: use prandom where cryptographically secure randomness is not needed

Currently get_random*() is used to determine the probability of fault
injection, but cryptographically secure random numbers are not required.

There is no big problem in using prandom instead of get_random*() to
determine the probability of fault injection, and it also avoids acquiring
a spinlock, which is unsafe in some contexts.

[akpm@linux-foundation.org: tweak and reflow comment]
Link: https://lore.kernel.org/lkml/20241129120939.GG35539@noisy.programming.kicks-ass.net
Link: https://lkml.kernel.org/r/20241208142415.205960-1-akinobu.mita@gmail.com
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/fault-inject.c