crypto: spacc - Fix uninitialized variable in spacc_aead_process()
PATCH 1/3 crypto: spacc - Fix uninitialized variable in spacc_aead_process()
In reply to a message not in the archiveSmatch complains that:
drivers/crypto/dwc-spacc/spacc_aead.c:1031 spacc_aead_process()
error: uninitialized symbol 'ptaadsize'.
This could happen if, for example, tctx->mode was CRYPTO_MODE_NULL and req->cryptlen was less than icvremove.
Fixes 06af76b46c78 ("crypto: spacc - Add SPAcc aead support")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/crypto/dwc-spacc/spacc_aead.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/crypto/dwc-spacc/spacc_aead.c +1 -3
@@ -823,7 +823,7 @@ static int spacc_aead_process(struct aead_request *req, u64 seq, int encrypt)u32 dstoff;int icvremove;int ivaadsize; -int ptaadsize; +int ptaadsize =0 ;int iv_to_context;int spacc_proc_len;u32 spacc_icv_offset =0 ;
@@ -974,8 +974,6 @@ static int spacc_aead_process(struct aead_request *req, u64 seq, int encrypt) tctx->mode == CRYPTO_MODE_NULL) {if (req->cryptlen >= icvremove) ptaadsize = req->cryptlen - icvremove; - } else { - ptaadsize =0 ; }/* Calculate and set the below, important parameters
Signature · 1 line
2.43.0
PATCH 2/3 crypto: spacc - Fix NULL vs IS_ERR() check in spacc_aead_fallback()
In reply to a message not in the archiveThe crypto_alloc_aead() function doesn't return NULL pointers, it returns error pointers. Fix the error checking.
Fixes 06af76b46c78 ("crypto: spacc - Add SPAcc aead support")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/crypto/dwc-spacc/spacc_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/dwc-spacc/spacc_aead.c +2 -2
@@ -784,9 +784,9 @@ static int spacc_aead_fallback(struct aead_request *req, ctx->fb.aead =crypto_alloc_aead (aead_name,0 ,CRYPTO_ALG_NEED_FALLBACK |CRYPTO_ALG_ASYNC ); -if (!ctx->fb.aead) { +if (IS_ERR (ctx->fb.aead)) {pr_err ("Spacc aead fallback tfm is NULL!\n" ); -return -EINVAL ; +return PTR_ERR (ctx->fb.aead); } subreq =aead_request_alloc (ctx->fb.aead,GFP_KERNEL );
Signature · 1 line
2.43.0
PATCH 3/3 crypto: spacc - Check for allocation failure in spacc_skcipher_fallback()
In reply to a message not in the archiveCheck for crypto_alloc_skcipher() failure.
Fixes c8981d9230d8 ("crypto: spacc - Add SPAcc Skcipher support")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/crypto/dwc-spacc/spacc_skcipher.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/dwc-spacc/spacc_skcipher.c +2 -0
@@ -67,6 +67,8 @@ static int spacc_skcipher_fallback(unsigned char *name, tctx->fb.cipher =crypto_alloc_skcipher (name,CRYPTO_ALG_TYPE_SKCIPHER ,CRYPTO_ALG_NEED_FALLBACK ); +if (IS_ERR (tctx->fb.cipher)) +return PTR_ERR (tctx->fb.cipher); crypto_skcipher_set_reqsize(reqtfm, sizeof(struct spacc_crypto_reqctx) +
Signature · 1 line
2.43.0