Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3910916imm; Mon, 8 Oct 2018 11:33:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV61npNlsT9khDbxCLeosh8Q6c/Y+vMbgN9umBZ2ufGPQYFIPw9XNtwuiTHu1OIMouP/YtwNP X-Received: by 2002:a63:a40a:: with SMTP id c10-v6mr22590777pgf.140.1539023589372; Mon, 08 Oct 2018 11:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023589; cv=none; d=google.com; s=arc-20160816; b=RTozUB/cv2+1N1h+Bfhc1QDVomsZ8H+qLuvfxKBZsUTTGEt2sEgfjthj6/jvgOh/nO OLAwZqT3RmBqKujPHhIJl9aa/hr13zxFXPkL5y1lTesURqOzeB/Afo1zPLbHzK8/npOv 9XWce2HHwvG+OWSZHAer2pNUMdDj9pJugGyTwzUm5yvhDc19azYHbhNQu9M/h8M9TJnq 5AuBZf+k6jUQ0tMTHc4QOVXpM159tevhbeC7EngRMrk+157DtvEGD8t0+3QfEO4M9+rv n6u1dmap9s02g5g4gNxFiqNKqAr3FgX7u5gq+OBJ+7PlIv9v2lYXg+vBrR3/cS10VKHk /qdw== 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:dkim-signature; bh=iBwfq0Xb2I4OPtlqsxG9hs/jB7/ptySJxhDtrBdsOWg=; b=tGhtw/xM3pjdfmt4qYdYDEY3ni1tLcnSHtLsbq4M1RWGJxfN+zJ+RuuDr8GrH2E7/e VhsTGJ+OtTjn4yEZewz0/6oXz4LQMbzIl5JIHvPLtDGU8csUDkqIdKy2lH+zgqg4FqZF XNLjxCxj6yMRyuClEeGhvPX/5As+517vvMvAB+KZUnpQzYyyAg6OpaDzZcZRElZHvj9l gBd7fLYrshewO1jl+HKMx5G7AIbGOkl1Zrs4/3OGFUmPzawMQBiNsmE+jxHVlE1DDIvV r/RcM4+rWXv0r1+K5Or2Jkd2s+PvK7tX5z/fpSCJvRAjqY4sTaQMuc5IDjxrGyPMjF6A uhlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fgbn1GZ1; 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 14-v6si14093482ple.236.2018.10.08.11.32.54; Mon, 08 Oct 2018 11:33:09 -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=@kernel.org header.s=default header.b=Fgbn1GZ1; 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 S1726503AbeJIBpr (ORCPT + 99 others); Mon, 8 Oct 2018 21:45:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:55306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbeJIBpq (ORCPT ); Mon, 8 Oct 2018 21:45:46 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07A172087D; Mon, 8 Oct 2018 18:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539023564; bh=8ymrmvLYEl3oKhbQyTlfL/sJyVEOwzQ55ZTZkypJEjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fgbn1GZ1neV0yw3bT7w8yD/UTmMAJ+BGs04mwUUat3Rp3pAKakiC1jg/SpM+vURJZ w2cfY/DLhl+GJrOZeAvvguSaT1/51I3BXgixs5y3VWSek1yIZInXI4sNaAHM1KXOrM t3WJA74dj4rJCkVt9dAJtw/1bTa9ykxq05wyntxI= 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.4 001/113] crypto: skcipher - Fix -Wstringop-truncation warnings Date: Mon, 8 Oct 2018 20:30:02 +0200 Message-Id: <20181008175530.936308092@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175530.864641368@linuxfoundation.org> References: <20181008175530.864641368@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.4-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 @@ -384,6 +384,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; @@ -465,6 +466,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 @@ -515,6 +515,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;