From patchwork Tue May 29 05:44:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 10434351 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF9B9601E9 for ; Tue, 29 May 2018 05:45:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D225F28485 for ; Tue, 29 May 2018 05:45:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4820285EE; Tue, 29 May 2018 05:45:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6904E28485 for ; Tue, 29 May 2018 05:45:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751385AbeE2FpD (ORCPT ); Tue, 29 May 2018 01:45:03 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:38644 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbeE2FpD (ORCPT ); Tue, 29 May 2018 01:45:03 -0400 Received: by mail-pl0-f66.google.com with SMTP id c11-v6so8286840plr.5; Mon, 28 May 2018 22:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Zk6GBcOZdqzTzUnhOc61ySX9VhepcYsaf3lH1aonKOo=; b=ns/4DcreQIv+rhbZI/Z6u0R5H1dMmg6VVawLwsIb5t8NWo+VN2qDF1GyhgN/zqhy/F MPBu4F/okPBgQxv1NsI9os19XlAQaenohDOS8TTbgpQqUDsIYQurvRVEGZ7t90K5FPb0 5LwSfO0UeyLoKzk7nnyQ9BwY5l1GEKyinkk3R2jIFt6OWPCLV8oMbFpeVOOxZPv36FO+ nHu2/BHbhWjRPbTHvF24RH3qESRVOSEbgMkGxcZJPu1ph0auZMxfpEZkP5TOhrEwDCIb 6J4166aFVecJhcH/hvQtlukSA5RZpjaVq6c45fcb1ggYCtQ45PGaDNyo2NXO2PTdODjd fX1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Zk6GBcOZdqzTzUnhOc61ySX9VhepcYsaf3lH1aonKOo=; b=uUb09d8A6mJ+V++H0kPAfBWv2omG2vWBESlMvLXt53KBEdXtluz+pfQwgxreZSmywN UAhmlCltG4n5U10Vh5+Iqz0Dy8EMSQRz7LR5I8GeYs5qNhxNYdROnTUhaxr8E8dcNJ4h y+kgzOehiS01YrBbIFWQy/rq7+KPusILaGQg9lsBkS6ED63QyCLdcV3thfkPkR3jrqZ5 b7ehMOQ+LdzGtJ5DnxTzUHDT5HVJQ3aBnRGXPNXJQFFzyQFM02GbaACCQGUuWL9sFrJP DhNEntplSOMqZ0qVsa6ynOe0Fg18jW8ypDwU15kzWB8aLoWys3s5aH3GHtvgR3e/8HAe L8vg== X-Gm-Message-State: ALKqPwcL0v8L62KGrBUiXsQpgBQQ3art3iWhVdY/l2QMlmgtR+flp8iP 73RXNhXcv+e7rO68C6jhkpA= X-Google-Smtp-Source: AB8JxZomtjqjPf+7XnxdUxQyEnR9VZy4pwpUay6RTMl2affCayOanIBA6EV+flIBdDwbY9slNfqyDw== X-Received: by 2002:a17:902:a5c7:: with SMTP id t7-v6mr16380023plq.360.1527572702237; Mon, 28 May 2018 22:45:02 -0700 (PDT) Received: from localhost.localdomain (c-24-6-183-110.hsd1.ca.comcast.net. [24.6.183.110]) by smtp.googlemail.com with ESMTPSA id q22-v6sm72724210pfk.4.2018.05.28.22.45.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 May 2018 22:45:01 -0700 (PDT) From: Nick Desaulniers To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: Nick Desaulniers , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: blkcipher: prefer strlcpy to strncpy Date: Mon, 28 May 2018 22:44:43 -0700 Message-Id: <1527572683-26098-1-git-send-email-nick.desaulniers@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes stringop-truncation warnings from gcc-8. Signed-off-by: Nick Desaulniers --- crypto/ablkcipher.c | 8 ++++---- crypto/blkcipher.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index d880a48..e38867f 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c @@ -370,8 +370,8 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_blkcipher rblkcipher; - strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type)); - strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", + strlcpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type)); + strlcpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", sizeof(rblkcipher.geniv)); rblkcipher.blocksize = alg->cra_blocksize; @@ -444,8 +444,8 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_blkcipher rblkcipher; - strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type)); - strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", + strlcpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type)); + strlcpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", sizeof(rblkcipher.geniv)); rblkcipher.blocksize = alg->cra_blocksize; diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 01c0d4a..ee88e48 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c @@ -509,8 +509,8 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_blkcipher rblkcipher; - strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type)); - strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "", + strlcpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type)); + strlcpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "", sizeof(rblkcipher.geniv)); rblkcipher.blocksize = alg->cra_blocksize;