Commit de2954d6 authored by Kim Phillips's avatar Kim Phillips Committed by Herbert Xu

crypto: caam - fix printk recursion for long error texts

during recent descriptor development, an Invalid Sequence Command
error triggered a:

BUG: recent printk recursion!

due to insufficient memory allocated for the error text.

The Invalid Sequence Command error text is the longest.
The length of the maximum error string is computed as
the sum of:

"DECO: ": 6
"jump tgt desc idx 255: ": 23
Invalid Sequence Command text: 272
zero termination character: 1

i.e, 302 characters.

Define this maximum error string length in error.h and fix
caam_jr_strstatus callsites.
Signed-off-by: default avatarKim Phillips <kim.phillips@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 701af31c
...@@ -113,7 +113,7 @@ static void split_key_done(struct device *dev, u32 *desc, u32 err, ...@@ -113,7 +113,7 @@ static void split_key_done(struct device *dev, u32 *desc, u32 err,
dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err); dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
#endif #endif
if (err) { if (err) {
char tmp[256]; char tmp[CAAM_ERROR_STR_MAX];
dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
} }
...@@ -414,7 +414,7 @@ static void ipsec_esp_encrypt_done(struct device *jrdev, u32 *desc, u32 err, ...@@ -414,7 +414,7 @@ static void ipsec_esp_encrypt_done(struct device *jrdev, u32 *desc, u32 err,
offsetof(struct ipsec_esp_edesc, hw_desc)); offsetof(struct ipsec_esp_edesc, hw_desc));
if (err) { if (err) {
char tmp[256]; char tmp[CAAM_ERROR_STR_MAX];
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
} }
...@@ -454,7 +454,7 @@ static void ipsec_esp_decrypt_done(struct device *jrdev, u32 *desc, u32 err, ...@@ -454,7 +454,7 @@ static void ipsec_esp_decrypt_done(struct device *jrdev, u32 *desc, u32 err,
offsetof(struct ipsec_esp_edesc, hw_desc)); offsetof(struct ipsec_esp_edesc, hw_desc));
if (err) { if (err) {
char tmp[256]; char tmp[CAAM_ERROR_STR_MAX];
dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
} }
......
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
#ifndef CAAM_ERROR_H #ifndef CAAM_ERROR_H
#define CAAM_ERROR_H #define CAAM_ERROR_H
#define CAAM_ERROR_STR_MAX 302
extern char *caam_jr_strstatus(char *outstr, u32 status); extern char *caam_jr_strstatus(char *outstr, u32 status);
#endif /* CAAM_ERROR_H */ #endif /* CAAM_ERROR_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment