diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 7153a50bce27..794c172b99f7 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c @@ -82,6 +82,9 @@ static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu, if (cpumask_test_cpu(cpu, cpumask->mask)) goto out; + if (!cpumask_weight(cpumask->mask)) + goto out; + cpu_index = cpu % cpumask_weight(cpumask->mask); cpu = cpumask_first(cpumask->mask);