Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3025244imm; Mon, 28 May 2018 22:47:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqKnAz//h2Vim7nK4+Y4yTUBafZHJUF+7OO0peJxy3AeTgjvthqJSk73p4RH5Kg/dGbTbXL X-Received: by 2002:a62:c987:: with SMTP id l7-v6mr15722889pfk.221.1527572821360; Mon, 28 May 2018 22:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527572821; cv=none; d=google.com; s=arc-20160816; b=H7HLnNWlbLBtbe7CQIrtPq2Xutb3ULlOoMXSTV2Dt/C4DuoTSeO/TWd2d0eqYnRi4y HYQApKweSnKPzRpeP2X8BK/bvPg1RrQxZU9/A47jbV06Vncd2w/ldPlQllCKV8lP/du7 mGfOKIxh3IW6Q0XgIMNgnt9juhlOOpi1nGTTxoipchYAgwxBoOg/g7Zj3piSiInWuRMC ozPQRbu5I3+mAuXURR90Bv4ta+A9Nf1c7tUznwdLFA1Zld1H4bpjwnwJZqXDJ/FiMrjT 0aIDeMli3YD/HCddJCvnDd/63R0L2jp/scEjW5p6lELvy1O1U0ZU77OHDJn41RDgRqdL wUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Zk6GBcOZdqzTzUnhOc61ySX9VhepcYsaf3lH1aonKOo=; b=qWdjgIJEvTGbfSaEKgPFf+sZp1VJhnR2XQKygo8XCfJ2QIdtcDnZdXMhFmzu8Xpw+q bTTPXkQxno/JJwtQkx73K9bkqiYHsOCCSNSQ3m1IzwmmCbGeZhe0FG1aI8LpgGzmNtnZ OGQ94dW1eqzXWxSxsKP1iusylXt+17E3z/mRnYgR2vVFtYRLlg8Rau4ZPZG6oIPgConT 3JDm/06X7FgDFMN0ES2/4X2IdNWHw/s0CRQ4eai4VhoggDLZcVuoAu9pyV76/ZcDJkmz LxnLHZn8MpYGYkhjsi2hyOjkZy/1kpY8gd9uGX/BlvGfPLhWChwYzWsYkMztT8o+9xL7 D9NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ns/4Dcre; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x15-v6si20760435pge.686.2018.05.28.22.46.45; Mon, 28 May 2018 22:47:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ns/4Dcre; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752283AbeE2FpE (ORCPT + 99 others); Tue, 29 May 2018 01:45:04 -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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4