From: Kim Phillips <kim.phillips@freescale.com>
To: Cristian Stoica <cristian.stoica@freescale.com>
Cc: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<horia.geanta@freescale.com>, <marex@denx.de>
Subject: Re: [PATCH] crypto: caam: fix error reporting
Date: Fri, 31 Oct 2014 13:22:09 -0500 [thread overview]
Message-ID: <20141031132209.5abced3ca9f55649d0bd6007@freescale.com> (raw)
In-Reply-To: <1414774653-3583-1-git-send-email-cristian.stoica@freescale.com>
On Fri, 31 Oct 2014 18:57:33 +0200
Cristian Stoica <cristian.stoica@freescale.com> wrote:
> The error code returned by hardware is four bits wide with an expected
> zero MSB. A hardware error condition where the error code can get between
> 0x8 and 0xf will trigger an out of bound array access on the error
> message table.
If this issue was brought up by h/w, the appropriate new error codes
should be being introduced.
Otherwise, I'm assuming it was brought up by a static code analyser,
which technically could be ignored, but...
> - /*
> - * If there is no further error handling function, just
> - * print the error code, error string and exit. Otherwise
> - * call the handler function.
> - */
why remove the comment? It's still valid.
> - if (!status_src[ssrc].report_ssed)
> - dev_err(jrdev, "%08x: %s: \n", status, status_src[ssrc].error);
> - else
> + if (status_src[ssrc].report_ssed)
> status_src[ssrc].report_ssed(jrdev, status, error);
> + else if (error)
> + dev_err(jrdev, "%d: %s\n", ssrc, error);
> + else
> + dev_err(jrdev, "%d: unknown error code\n", ssrc);
This is simpler:
diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c
index 6531054..6f4a148 100644
--- a/drivers/crypto/caam/error.c
+++ b/drivers/crypto/caam/error.c
@@ -224,7 +224,12 @@ void caam_jr_strstatus(struct device *jrdev, u32 status)
{ report_cond_code_status, "Condition Code" },
};
u32 ssrc = status >> JRSTA_SSRC_SHIFT;
- const char *error = status_src[ssrc].error;
+ const char *error;
+
+ if (ssrc >= ARRAY_SIZE(status_src)) {
+ dev_err(jrdev, "unknown error status source %d\n", ssrc);
+ return;
+ }
/*
* If there is no further error handling function, just
Kim
next prev parent reply other threads:[~2014-10-31 18:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 16:57 Cristian Stoica
2014-10-31 18:22 ` Kim Phillips [this message]
2014-11-01 11:43 ` Marek Vasut
2014-11-03 9:18 ` Cristian Stoica
2014-11-03 19:47 ` Kim Phillips
2014-11-04 8:57 ` Cristian Stoica
2014-11-04 16:57 ` Kim Phillips
2014-11-05 9:21 ` [PATCH v2] " Cristian Stoica
2014-11-05 16:43 ` Kim Phillips
2014-11-06 8:01 ` Cristian Stoica
2014-11-06 15:17 ` Herbert Xu
2014-11-05 9:27 ` [PATCH] " Cristian Stoica
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=20141031132209.5abced3ca9f55649d0bd6007@freescale.com \
--to=kim.phillips@freescale.com \
--cc=cristian.stoica@freescale.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@freescale.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
/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
all inboxes | Powered by JetHome®