Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Pavitrakumar M <pavitrakumarm@vayavyalabs.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	shwetar <shwetar@vayavyalabs.com>,
	Ruud Derwig <Ruud.Derwig@synopsys.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] crypto: spacc - Fix uninitialized variable in spacc_aead_process()
Date: Thu, 15 Aug 2024 14:20:04 +0300	[thread overview]
Message-ID: <74ca2a96-978d-4d22-a787-04ceaa08aff6@stanley.mountain> (raw)
In-Reply-To: <0c352e73-714a-476e-8e71-eef750f22902@stanley.mountain>

Smatch 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 <dan.carpenter@linaro.org>
---
 drivers/crypto/dwc-spacc/spacc_aead.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/dwc-spacc/spacc_aead.c b/drivers/crypto/dwc-spacc/spacc_aead.c
index 3468ff605957..50ef9053fc4d 100755
--- a/drivers/crypto/dwc-spacc/spacc_aead.c
+++ b/drivers/crypto/dwc-spacc/spacc_aead.c
@@ -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
-- 
2.43.0


       reply	other threads:[~2024-08-15 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0c352e73-714a-476e-8e71-eef750f22902@stanley.mountain>
2024-08-15 11:20 ` Dan Carpenter [this message]
2024-08-15 11:20 ` [PATCH 2/3] crypto: spacc - Fix NULL vs IS_ERR() check in spacc_aead_fallback() Dan Carpenter
2024-08-15 11:20 ` [PATCH 3/3] crypto: spacc - Check for allocation failure in spacc_skcipher_fallback() Dan Carpenter

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=74ca2a96-978d-4d22-a787-04ceaa08aff6@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=Ruud.Derwig@synopsys.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavitrakumarm@vayavyalabs.com \
    --cc=shwetar@vayavyalabs.com \
    /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