From nobody Mon Feb 9 07:19:29 2026 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28862356A3E for ; Mon, 2 Feb 2026 23:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770073307; cv=none; b=PFWUJWE/DMNRdhBwLGvrNM1DWYpYddMqBnPu9+Zt6eF5R+C9yAnkhabfYfCD4xtYJrqHSIpx3LUs4PQFTHdphJmHyHRORHRtvoeHnZvheXhYV965SiE9/zyXBZgl70Twy4r//w7W/LjwujnZ11SlM2OzWPYcxus5T2lE8Eiod/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770073307; c=relaxed/simple; bh=4HajR9oDzuyJDc1r4jBrfluaT9V3NPSsXOAaA8E2Bls=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Cje8rfJsN7vTlUzfx7MpcqXMqxTRNoeJJ1txb2WaHxZ0gH0BhMyYHHaau6zbg0DtLcfr/wphIs5op+7hVGooVDzgaqpFmTwaekRi1X+COxKcAQ4UVi7o6g7t7xWl0NzZ6lmSdUAk9LdZJa4ORBPFd9n4R4YY3ktHH/wfHRWBVS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dKCLIIB7; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dKCLIIB7" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770073302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=p6ynb+zgPuGJeSWj6XPcxGqyQpSs9lMJOY2jclvij24=; b=dKCLIIB7U62knZoEnxjVd6xQUD2el0rxCOrCHAVUIPsjNCtpdqm+W4BE1MZ7k5FfELlO41 CAq3moG0l9X4mnsnZPmhs2ussCpv1CIdVRCo6dx2G1Y6EE+C9CH9EW88Ab1TZANYqygnH5 z7ddt5vIxHcNTgAn7SIdiXDDXLAPIW8= From: Thorsten Blum To: =?UTF-8?q?Horia=20Geant=C4=83?= , Pankaj Gupta , Gaurav Jain , Herbert Xu , "David S. Miller" Cc: Thorsten Blum , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: caam - Replace snprintf with strscpy in caam_hash_alloc Date: Tue, 3 Feb 2026 00:01:17 +0100 Message-ID: <20260202230117.936865-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace snprintf("%s", ...) with the faster and more direct strscpy(). Signed-off-by: Thorsten Blum --- drivers/crypto/caam/caamalg_qi2.c | 13 +++++-------- drivers/crypto/caam/caamhash.c | 12 ++++-------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamal= g_qi2.c index 107ccb2ade42..478ef597f33f 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -4644,16 +4645,12 @@ static struct caam_hash_alg *caam_hash_alloc(struct= device *dev, alg =3D &halg->halg.base; =20 if (keyed) { - snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", - template->hmac_name); - snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", - template->hmac_driver_name); + strscpy(alg->cra_name, template->hmac_name); + strscpy(alg->cra_driver_name, template->hmac_driver_name); t_alg->is_hmac =3D true; } else { - snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", - template->name); - snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", - template->driver_name); + strscpy(alg->cra_name, template->name); + strscpy(alg->cra_driver_name, template->driver_name); t_alg->ahash_alg.setkey =3D NULL; t_alg->is_hmac =3D false; } diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 25c02e267258..eeb444f8ba85 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -1913,16 +1913,12 @@ caam_hash_alloc(struct caam_hash_template *template, alg =3D &halg->halg.base; =20 if (keyed) { - snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", - template->hmac_name); - snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", - template->hmac_driver_name); + strscpy(alg->cra_name, template->hmac_name); + strscpy(alg->cra_driver_name, template->hmac_driver_name); t_alg->is_hmac =3D true; } else { - snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", - template->name); - snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", - template->driver_name); + strscpy(alg->cra_name, template->name); + strscpy(alg->cra_driver_name, template->driver_name); halg->setkey =3D NULL; t_alg->is_hmac =3D false; } --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4