From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.hengli.com.au>
Cc: Dan Kruchinin <dkruchinin@acm.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] crypto: pcrypt - Dont calulate a callback cpu on empty callback cpumask
Date: Tue, 20 Jul 2010 08:52:20 +0200 [thread overview]
Message-ID: <20100720065220.GF11081@secunet.com> (raw)
In-Reply-To: <20100720064736.GB11081@secunet.com>
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>
---
crypto/pcrypt.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 7153a50..794c172 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);
--
1.5.6.5
next prev parent reply other threads:[~2010-07-20 6:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 10:29 [PATCH 0/3] padata: cpumasks Dan Kruchinin
2010-07-19 6:04 ` Herbert Xu
2010-07-19 6:40 ` Steffen Klassert
2010-07-19 7:32 ` Herbert Xu
2010-07-20 6:47 ` [PATCH 0/4] padata/pcrypt: fixes Steffen Klassert
2010-07-20 6:48 ` [PATCH 1/4] padata: Fix cpu index counting Steffen Klassert
2010-07-20 6:49 ` [PATCH 2/4] padata: Allocate cpumask dependend recources in any case Steffen Klassert
2010-07-20 6:51 ` [PATCH 3/4] padata: Check for valid cpumasks Steffen Klassert
2010-07-20 6:52 ` Steffen Klassert [this message]
2010-07-26 6:16 ` [PATCH 0/4] padata/pcrypt: fixes Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100720065220.GF11081@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=akpm@linux-foundation.org \
--cc=dkruchinin@acm.org \
--cc=herbert@gondor.hengli.com.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox