Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1350718imm; Tue, 2 Oct 2018 06:57:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV6370QjXHcInrtMNKvJQoGBeO1SGCM+zCFsOSJbmQKPJLI2xkNkgJ8pPmlLM5DzC7jhdHoii X-Received: by 2002:a63:e943:: with SMTP id q3-v6mr14468844pgj.42.1538488654548; Tue, 02 Oct 2018 06:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488654; cv=none; d=google.com; s=arc-20160816; b=G/oH40WJISpv+DyfND+NI/5eXvfpEF7OEJNLKdHK2h8WmIaf4Y5bHMeFA8GL6jm0Cy cze020yN3BDHflpUd880S1LXWADkbrDDNJRk+qiamMeGgZAIzIpM/hdzXs+OET6jLwnR genh+barqStoaPSpI8zWwW9joK1FUsdcAdY1k4Juvn24NjKXcJMWM0x+lkPr93wNROmC RY6SznxwHAvh+f2ZCNQY5lHSbC6/VaJwTJHbtXxcRSB3H9R8HBWy7LAkCVdHxbrwSaKL Sy7gYF7NJaG2N7TDQ3tM5fxC+PMZALxaQ2wCzxbZFNTR81y8dFfGK/lfTNluSKRUF1Zk NnFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=hG4CA0Qxs2do8S38XgTRZkW6x9thh8wpHY8BWew25rA=; b=ENTMFs3oPRF49WNaMdq+34bU+PGHuCL0uYfVQfV+latBEB9DTfqKBlmQ+CkosMEH1+ vnmOGptlTeC81Mf6RpYCfFKrDipy8S/5wTMPnA3v2XbYLY+GgIzS0iYTuG4zNFDHsDOx VhsvHtDqD/zdzukGNXy1EU9pOA6FgyDuF/mqlaI/AXnQWJIpsrh+oL+G8c3zBy2cmooS W1bYLbkkGEMK8C5hdFX6FSBgOj7mJV5MvGCNim5z03d1JhiAcH0tSY1sqShD2pI4iBcP REtk2Vu4HIsXWn1fNNJh5XY/q+pGnOVFiqsR6edsyxidxXEXqRvEHHTUMw5pMA1IPQrb B4Fw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i21-v6si14067785pgg.513.2018.10.02.06.57.19; Tue, 02 Oct 2018 06:57:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731361AbeJBUkB (ORCPT + 99 others); Tue, 2 Oct 2018 16:40:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34160 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731010AbeJBUOx (ORCPT ); Tue, 2 Oct 2018 16:14:53 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DA9D8C47; Tue, 2 Oct 2018 13:31:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Max Filippov , Eric Biggers , Nick Desaulniers , Stafford Horne , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 001/137] crypto: skcipher - Fix -Wstringop-truncation warnings Date: Tue, 2 Oct 2018 06:23:22 -0700 Message-Id: <20181002132458.526593446@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132458.446916963@linuxfoundation.org> References: <20181002132458.446916963@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stafford Horne [ Upstream commit cefd769fd0192c84d638f66da202459ed8ad63ba ] As of GCC 9.0.0 the build is reporting warnings like: crypto/ablkcipher.c: In function ‘crypto_ablkcipher_report’: crypto/ablkcipher.c:374:2: warning: ‘strncpy’ specified bound 64 equals destination size [-Wstringop-truncation] strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof(rblkcipher.geniv)); ~~~~~~~~~~~~~~~~~~~~~~~~~ This means the strnycpy might create a non null terminated string. Fix this by explicitly performing '\0' termination. Cc: Greg Kroah-Hartman Cc: Arnd Bergmann Cc: Max Filippov Cc: Eric Biggers Cc: Nick Desaulniers Signed-off-by: Stafford Horne Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- crypto/ablkcipher.c | 2 ++ crypto/blkcipher.c | 1 + 2 files changed, 3 insertions(+) --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c @@ -368,6 +368,7 @@ static int crypto_ablkcipher_report(stru strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type)); strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", sizeof(rblkcipher.geniv)); + rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0'; rblkcipher.blocksize = alg->cra_blocksize; rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; @@ -442,6 +443,7 @@ static int crypto_givcipher_report(struc strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type)); strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", sizeof(rblkcipher.geniv)); + rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0'; rblkcipher.blocksize = alg->cra_blocksize; rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c @@ -511,6 +511,7 @@ static int crypto_blkcipher_report(struc strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type)); strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "", sizeof(rblkcipher.geniv)); + rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0'; rblkcipher.blocksize = alg->cra_blocksize; rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;