Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	John Allen <john.allen@amd.com>,
	Weili Qian <qianweili@huawei.com>,
	Zhou Wang <wangzhou1@hisilicon.com>,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
	Srujana Challa <schalla@marvell.com>,
	Bharat Bhushan <bbhushan2@marvell.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	qat-linux@intel.com, Thorsten Blum <thorsten.blum@linux.dev>,
	Longfang Liu <liulongfang@huawei.com>
Subject: [PATCH v2 4/6] crypto: hisilicon - use 2-arg strscpy where destination size is known
Date: Sat,  6 Jun 2026 01:11:01 +0200	[thread overview]
Message-ID: <20260605231056.1622060-12-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20260605231056.1622060-8-thorsten.blum@linux.dev>

To simplify the code, drop explicit and hard-coded size arguments from
strscpy() where the destination buffer has a fixed size and strscpy()
can automatically determine it using sizeof().

Reviewed-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/hisilicon/qm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index a951d2ef7833..c01966a4a33f 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -2944,11 +2944,8 @@ static int qm_alloc_uacce(struct hisi_qm *qm)
 		.flags = UACCE_DEV_SVA,
 		.ops = &uacce_qm_ops,
 	};
-	int ret;
 
-	ret = strscpy(interface.name, dev_driver_string(&pdev->dev),
-		      sizeof(interface.name));
-	if (ret < 0)
+	if (strscpy(interface.name, dev_driver_string(&pdev->dev)) < 0)
 		return -ENAMETOOLONG;
 
 	uacce = uacce_alloc(&pdev->dev, &interface);

  parent reply	other threads:[~2026-06-05 23:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05 23:10 [PATCH v2 0/6] crypto: use 2-arg strscpy where destination size is known Thorsten Blum
2026-06-05 23:10 ` [PATCH v2 1/6] " Thorsten Blum
2026-06-05 23:10 ` [PATCH v2 2/6] crypto: cavium - " Thorsten Blum
2026-06-05 23:11 ` [PATCH v2 3/6] crypto: ccp " Thorsten Blum
2026-06-05 23:11 ` Thorsten Blum [this message]
2026-06-05 23:11 ` [PATCH v2 5/6] crypto: qat " Thorsten Blum
2026-06-05 23:11 ` [PATCH v2 6/6] crypto: octeontx " Thorsten Blum

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=20260605231056.1622060-12-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=bbhushan2@marvell.com \
    --cc=davem@davemloft.net \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.allen@amd.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=qat-linux@intel.com \
    --cc=qianweili@huawei.com \
    --cc=schalla@marvell.com \
    --cc=thomas.lendacky@amd.com \
    --cc=wangzhou1@hisilicon.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