diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 5c16019cf3068fc6c50fd27efe5d3038969e0bf4..b97575e414f6ec977171f48d76f24f06b85f890c 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -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);
 #endif
 	if (err) {
-		char tmp[256];
+		char tmp[CAAM_ERROR_STR_MAX];
 
 		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,
 		 offsetof(struct ipsec_esp_edesc, hw_desc));
 
 	if (err) {
-		char tmp[256];
+		char tmp[CAAM_ERROR_STR_MAX];
 
 		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,
 		 offsetof(struct ipsec_esp_edesc, hw_desc));
 
 	if (err) {
-		char tmp[256];
+		char tmp[CAAM_ERROR_STR_MAX];
 
 		dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err));
 	}
diff --git a/drivers/crypto/caam/error.h b/drivers/crypto/caam/error.h
index 067afc12013276c9486513e80c5e7db03e74fedc..02c7baa1748e44ed7da80074ba34bcb86d8e60c8 100644
--- a/drivers/crypto/caam/error.h
+++ b/drivers/crypto/caam/error.h
@@ -6,5 +6,6 @@
 
 #ifndef CAAM_ERROR_H
 #define CAAM_ERROR_H
+#define CAAM_ERROR_STR_MAX 302
 extern char *caam_jr_strstatus(char *outstr, u32 status);
 #endif /* CAAM_ERROR_H */