From patchwork Thu Aug 18 20:59:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 12947875 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5437C28B2B for ; Thu, 18 Aug 2022 21:00:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346211AbiHRVAM (ORCPT ); Thu, 18 Aug 2022 17:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346161AbiHRU76 (ORCPT ); Thu, 18 Aug 2022 16:59:58 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 223A4D345A for ; Thu, 18 Aug 2022 13:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=k1; bh=ojJlM1/GkfOq9xdq8lbRxMQgmxl ANYIRRM5Y9WC7DC0=; b=mi9PY5riWP0T5FYMm8Hw2l0DUS57IhkE7rJRTNhvarY e/+y+MDahSORAodqIVqpxp9iimcfm6iH7DLrwX0Xcnp9XT6xnbnzr1WkgwY9Wz71 m1TJNbV3M7D9EwtDqnwda+i4cKkvyt7UqB//cIIHtBYsmm3BeKRXQ86O1CPe7eXo = Received: (qmail 3959355 invoked from network); 18 Aug 2022 22:59:55 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 22:59:55 +0200 X-UD-Smtp-Session: l3s3148p1@tI1rQ4rmDo8ucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org Subject: [PATCH] crypto: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 22:59:54 +0200 Message-Id: <20220818205954.6480-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang --- crypto/api.c | 2 +- crypto/essiv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/api.c b/crypto/api.c index 69508ae9345e..a2b79d517a06 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -114,7 +114,7 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask) larval->alg.cra_priority = -1; larval->alg.cra_destroy = crypto_larval_destroy; - strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); + strscpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); init_completion(&larval->completion); return larval; diff --git a/crypto/essiv.c b/crypto/essiv.c index 8bcc5bdcb2a9..e33369df9034 100644 --- a/crypto/essiv.c +++ b/crypto/essiv.c @@ -543,7 +543,7 @@ static int essiv_create(struct crypto_template *tmpl, struct rtattr **tb) } /* record the driver name so we can instantiate this exact algo later */ - strlcpy(ictx->shash_driver_name, hash_alg->base.cra_driver_name, + strscpy(ictx->shash_driver_name, hash_alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME); /* Instance fields */