diff options
author | tuxoko <[email protected]> | 2016-10-07 20:59:46 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-10-07 20:59:46 -0700 |
commit | 0d267566650d89bde8bd5ec4665749810d5bafc7 (patch) | |
tree | 9938ec689e4de3209b2d2d2d257a311832aecbb7 | |
parent | 2529b3a80e1bf1713c0ecbedb246654a0968b4d2 (diff) |
Fix out-of-bound in per_cpu in spl_random_init
When iterating per_cpu values, we need to use for_each_possible_cpu. While
NR_CPUS indicates the number of CPU supported by the kernel, it might not
initialize all of them if the kernel decides it's not possible to use them.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #578
-rw-r--r-- | module/spl/spl-generic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index c04cb538c..ce60963bd 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -638,7 +638,7 @@ spl_random_init(void) "0x%016llx%016llx.", cpu_to_be64(s[0]), cpu_to_be64(s[1])); } - for (i = 0; i < NR_CPUS; i++) { + for_each_possible_cpu(i) { uint64_t *wordp = per_cpu(spl_pseudo_entropy, i); spl_rand_jump(s); |