Commit cc74f4bc111e9554bcd6445ad0fe1d90e5d2eb34

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent 7424713b83

crypto: pcrypt - Dont calulate a callback cpu on empty callback cpumask

If the callback cpumask is empty, we crash with a division by zero
when we try to calculate a callback cpu. So we don't update the callback
cpu in pcrypt_do_parallel if the callback cpumask is empty.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

... ... @@ -82,6 +82,9 @@
82 82 if (cpumask_test_cpu(cpu, cpumask->mask))
83 83 goto out;
84 84  
  85 + if (!cpumask_weight(cpumask->mask))
  86 + goto out;
  87 +
85 88 cpu_index = cpu % cpumask_weight(cpumask->mask);
86 89  
87 90 cpu = cpumask_first(cpumask->mask);