diff mbox series

[1/4] crypto: caam: print IV only when non NULL

Message ID 20190523085030.4969-2-s.hauer@pengutronix.de (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: CAAM: Print debug messages at debug level | expand

Commit Message

Sascha Hauer May 23, 2019, 8:50 a.m. UTC
Since eaed71a44ad9 ("crypto: caam - add ecb(*) support") the IV can be
NULL, so only dump it when it's non NULL as designated by the ivsize
variable.

Fixes: eaed71a44ad9 ("crypto: caam - add ecb(*) support")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/crypto/caam/caamalg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Herbert Xu May 30, 2019, 1:43 p.m. UTC | #1
On Thu, May 23, 2019 at 10:50:27AM +0200, Sascha Hauer wrote:
> Since eaed71a44ad9 ("crypto: caam - add ecb(*) support") the IV can be
> NULL, so only dump it when it's non NULL as designated by the ivsize
> variable.
> 
> Fixes: eaed71a44ad9 ("crypto: caam - add ecb(*) support")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/crypto/caam/caamalg.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

All applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index c0ece44f303b..bffff5415c74 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1011,9 +1011,10 @@  static void skcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err,
 		caam_jr_strstatus(jrdev, err);
 
 #ifdef DEBUG
-	print_hex_dump(KERN_ERR, "dstiv  @"__stringify(__LINE__)": ",
-		       DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
-		       edesc->src_nents > 1 ? 100 : ivsize, 1);
+	if (ivsize)
+		print_hex_dump(KERN_ERR, "dstiv  @"__stringify(__LINE__)": ",
+			       DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
+			       edesc->src_nents > 1 ? 100 : ivsize, 1);
 #endif
 	caam_dump_sg(KERN_ERR, "dst    @" __stringify(__LINE__)": ",
 		     DUMP_PREFIX_ADDRESS, 16, 4, req->dst,