diff options
author | Theodore Ts'o | 2016-07-27 23:30:25 -0400 |
---|---|---|
committer | Theodore Ts'o | 2016-07-27 23:30:25 -0400 |
commit | 59b8d4f1f5d26e4ca92172ff6dcd1492cdb39613 (patch) | |
tree | 946cb48bfa761f7d30ff0f99f5fcb9e158d9362f /drivers/char | |
parent | 86a574de4590ffe6fd3f3ca34cdcf655a78e36ec (diff) |
random: use for_each_online_node() to iterate over NUMA nodes
This fixes a crash on s390 with fake NUMA enabled.
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly userspace programs")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 8d0af74f6569..7f0622426b97 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1668,13 +1668,12 @@ static int rand_initialize(void) #ifdef CONFIG_NUMA pool = kmalloc(num_nodes * sizeof(void *), GFP_KERNEL|__GFP_NOFAIL|__GFP_ZERO); - for (i=0; i < num_nodes; i++) { + for_each_online_node(i) { crng = kmalloc_node(sizeof(struct crng_state), GFP_KERNEL | __GFP_NOFAIL, i); spin_lock_init(&crng->lock); crng_initialize(crng); pool[i] = crng; - } mb(); crng_node_pool = pool; |