mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qi Tao <taoqi10@huawei.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<liulongfang@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>
Subject: [PATCH 3/4] crypto: hisilicon/sec2 - fix some cleanup issues
Date: Fri, 29 Dec 2023 14:44:20 +0800	[thread overview]
Message-ID: <20231229064421.16981-4-taoqi10@huawei.com> (raw)
In-Reply-To: <20231229064421.16981-1-taoqi10@huawei.com>

This patch fixes following cleanup issues:
 - The return value of the function is
   inconsistent with the actual return type.
 - After the pointer type is directly converted
   to the '__le64' type, the program may crash
   or produce unexpected results.

Signed-off-by: Qi Tao <taoqi10@huawei.com>
---
 drivers/crypto/hisilicon/sec2/sec_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index 692ba3213cc6..5d4facf62c86 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -118,7 +118,7 @@ struct sec_aead {
 };
 
 /* Get an en/de-cipher queue cyclically to balance load over queues of TFM */
-static inline int sec_alloc_queue_id(struct sec_ctx *ctx, struct sec_req *req)
+static inline u32 sec_alloc_queue_id(struct sec_ctx *ctx, struct sec_req *req)
 {
 	if (req->c_req.encrypt)
 		return (u32)atomic_inc_return(&ctx->enc_qcyclic) %
@@ -1371,7 +1371,7 @@ static int sec_skcipher_bd_fill_v3(struct sec_ctx *ctx, struct sec_req *req)
 	sec_sqe3->bd_param = cpu_to_le32(bd_param);
 
 	sec_sqe3->c_len_ivin |= cpu_to_le32(c_req->c_len);
-	sec_sqe3->tag = cpu_to_le64(req);
+	sec_sqe3->tag = cpu_to_le64((unsigned long)(uintptr_t)req);
 
 	return 0;
 }
-- 
2.33.0


  parent reply	other threads:[~2023-12-29  6:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  6:44 [PATCH v2 0/4] some updates and cleanups for hisilicon/sec2 Qi Tao
2023-12-29  6:44 ` [PATCH 1/4] crypto: hisilicon/sec2 - updates the sec DFX function register Qi Tao
2023-12-29  6:44 ` [PATCH 2/4] crypto: hisilicon/sec2 - modify nested macro call Qi Tao
2023-12-29  6:44 ` Qi Tao [this message]
2024-01-25  9:37   ` [PATCH 3/4] crypto: hisilicon/sec2 - fix some cleanup issues Herbert Xu
2024-01-26  8:40     ` taoqi
2024-01-26  8:54       ` Herbert Xu
2023-12-29  6:44 ` [PATCH 4/4] crypto: hisilicon/sec - remove unused parameter Qi Tao
2024-01-04  7:58 ` [PATCH v2 0/4] some updates and cleanups for hisilicon/sec2 liulongfang
2024-01-19  6:25 ` taoqi

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=20231229064421.16981-4-taoqi10@huawei.com \
    --to=taoqi10@huawei.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liulongfang@huawei.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

all inboxes | Powered by JetHome®