From: Lee Nipper <lee.nipper@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: kim.phillips@freescale.com, Lee Nipper <lee.nipper@gmail.com>
Subject: [PATCH] crypto: talitos - protect against possible null ptr upon error
Date: Sun, 15 Mar 2009 20:21:47 -0500 [thread overview]
Message-ID: <1237166510-7312-1-git-send-email-lee.nipper@gmail.com> (raw)
Added test for null descriptor returned from current_desc.
Also removed the diagnostic from current_desc,
and added one instead in talitos_error
to report an EU error without finding the descriptor.
Signed-off-by: Lee Nipper <lee.nipper@gmail.com>
---
drivers/crypto/talitos.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index a3918c1..d853530 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -401,10 +401,8 @@ static struct talitos_desc *current_desc(struct device *dev, int ch)
while (priv->fifo[ch][tail].dma_desc != cur_desc) {
tail = (tail + 1) & (priv->fifo_len - 1);
- if (tail == priv->tail[ch]) {
- dev_err(dev, "couldn't locate current descriptor\n");
+ if (tail == priv->tail[ch])
return NULL;
- }
}
return priv->fifo[ch][tail].desc;
@@ -523,8 +521,14 @@ static void talitos_error(unsigned long data, u32 isr, u32 isr_lo)
dev_err(dev, "illegal descriptor header error\n");
if (v_lo & TALITOS_CCPSR_LO_IEU)
dev_err(dev, "invalid execution unit error\n");
- if (v_lo & TALITOS_CCPSR_LO_EU)
- report_eu_error(dev, ch, current_desc(dev, ch));
+ if (v_lo & TALITOS_CCPSR_LO_EU) {
+ struct talitos_desc *desc = current_desc(dev, ch);
+ if (desc)
+ report_eu_error(dev, ch, desc);
+ else
+ dev_err(dev,
+ "EU error, but no descriptor found.\n");
+ }
if (v_lo & TALITOS_CCPSR_LO_GB)
dev_err(dev, "gather boundary error\n");
if (v_lo & TALITOS_CCPSR_LO_GRL)
--
1.5.6.3
next reply other threads:[~2009-03-16 1:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-16 1:21 Lee Nipper [this message]
2009-03-16 1:21 ` [PATCH 1/3] crypto: talitos - scaffolding for new algorithm types Lee Nipper
2009-03-16 1:21 ` [PATCH 2/3] crypto: talitos - Add ablkcipher algorithms Lee Nipper
2009-03-16 1:21 ` [PATCH 3/3] crypto: talitos - Add ahash algorithms (1st cut, digest only) Lee Nipper
2009-03-25 0:11 ` Kim Phillips
2009-03-24 23:57 ` [PATCH 2/3] crypto: talitos - Add ablkcipher algorithms Kim Phillips
2009-03-24 23:34 ` [PATCH 1/3] crypto: talitos - scaffolding for new algorithm types Kim Phillips
2009-03-24 21:23 ` [PATCH] crypto: talitos - protect against possible null ptr upon error Kim Phillips
2009-03-25 4:06 ` Lee Nipper
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=1237166510-7312-1-git-send-email-lee.nipper@gmail.com \
--to=lee.nipper@gmail.com \
--cc=kim.phillips@freescale.com \
--cc=linux-crypto@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.