Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3657793imc; Thu, 14 Mar 2019 02:11:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDP2qb2LwTsVGAtckMeG60TOeIMTtgu2uVQbIipaSTGB4390nssg/Nq+5jVsl6+TMaurlH X-Received: by 2002:a17:902:b60c:: with SMTP id b12mr49771998pls.261.1552554680690; Thu, 14 Mar 2019 02:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552554680; cv=none; d=google.com; s=arc-20160816; b=NJ5J8rJfN4ACsPwjpEqAmNJVFCUC6y8i8UJ3y+V6EiQDu7IK6oHq5otouA1nRKdVam R/32NJmQXUMgt4OHHCZapbago7dHJZ9b+CoVK0/23Ac3FcwzU436QnRW2Tu7qL5gxdoK QPgVxySZpQ7220uL7d38aStB3BI8paxHIy8Teou935ORkzH9sb4Yloa2kaZHrs9p7Yp1 G2XJWFciPNKBE0ezSbhabVNbUU0W52yhtgbLA2WxytxI4/Qf/DFm/sgP/zYSEcYtC08R d8vQTVpwQmb0/D8i2crFjyg4O51bx3cLkTa8B+q/tPIRooNQZ2wosGAcT2SHve6pALPH SQ4g== 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 :message-id:date:subject:cc:to:from; bh=IMfSoL9sb/EUPaC6SSb2zz5ZF/7rtttdefiT/KgFtYw=; b=SKrqm+F0Roc2LYHPVyOcfdbDmmVSmOkIO+kTW1P+WcRKEFZQIWfiT2Tq6m61bUV1x+ Zyze2CFBDreya7BwVth7y9lfAYREjlGajY6ngMClHfRrZfUAvXXPgkqvY/szsI1N6WVq bYCjz0FR7ve1Pvvb+cwHNqiVM55aeUM2tpCRJhqRuWSvPmf03Bui4+2vokGiZ/GcVNGR Xw2YynecHaBbuAsyABTl6CKxPdY7exkzGl0bCubARUD7+qjDiMN9xnOjNhi92T7xz6x4 S4OS60N2JSRP7/PU6TA+pMNOAx4f2khmgXN4Nl3r2dATSdtpYmpz70SRln/QPaZgEE3M h7Xw== 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 p4si14162384pli.159.2019.03.14.02.11.04; Thu, 14 Mar 2019 02:11:20 -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 S1726776AbfCNJKV (ORCPT + 99 others); Thu, 14 Mar 2019 05:10:21 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:36675 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726643AbfCNJKV (ORCPT ); Thu, 14 Mar 2019 05:10:21 -0400 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M2fHt-1h2ynU0CvH-0049NE; Thu, 14 Mar 2019 10:09:55 +0100 From: Arnd Bergmann To: Gilad Ben-Yossef , Herbert Xu , "David S. Miller" Cc: Arnd Bergmann , Eric Biggers , "Gustavo A. R. Silva" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: ccree - reduce kernel stack usage with clang Date: Thu, 14 Mar 2019 10:09:44 +0100 Message-Id: <20190314090951.840339-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:dC2/9ebq8Fl87hFsAGo8uXPuzKOIpvo5VAfANriH0gumyH5BOTy z/B8RkJxqYPeuEf2Usa/7AfuMd6ADIfBgjmf6BHXuBg8D7Xz+JcCGlbEdAjfX/pNUSrv5JO kSCI+5Z3j7U2zDbIRE15lP+xOYp6wXIm540MO9MUcgC90d2xQtHYMhov0Bs7U3n/yn4uaVj MPCytK7jL6ymKPkKwiZhg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:2hnnBTrxZqQ=:4s80T4F2tNNIaYm7AxA+Cv aSGxZJQ2YlUVfDbLMo696alA+z6wMIR0X8XmruAKbJctlCTJuW9rWtC+qj2f4xJbbXEUgDneX 1i305sLyEaqi3uegdTD9wYpj7vCdXW1BaugAW4IK1FhOGpQeLRlOqQQMHk83UogADm4lM/slB 5Pb6+EbQemIZG7M5rZ2Zwmn+camQ/HTvxuESWHriJMOIVGsrDftysDJW2Vwv7vf18GMlBcrCC b8UKk2p2ShHylSNUo8Fu20e1aBEbQLOG49PJ16/zaD/GthYh1AHUsz+RmrGF/P7SsaheOLUVp RyA/GbERaeuFeXWuWym7JKXt69gahnCz8CEH/zZX2f1Hp7BKn6KeL+6wcZHfbMtR//N4kgvI/ +sL+JbfBG1EEhVNLGrCuyKeGtn1zFW1Gj3ArqZZ03ccWszC/phEvoCZR1wKfPzpiacZ+osF1K mB8LvHhN4XtdBUwp2WuAViTWAQIMhd/qhDdVQW/2oEEFag82qwMPL1A50k5ze+Q4OFrax+j3v m4CSQrN3mfZqw6hIxnUYG6mtUm1Opfgf/mfs9WhPWLEGusoGmKNkfl0wAue6FbA+5MANSszcX W8Awiz17WgMRsf4TsjR1SmdwK4U94pkRLOmjMQrCuC6GBSrqf+mIB3HtUEwxp4uJhWo5Hswls waFVJDO6SoGYnItivaxnH544Kr0mj7RTc2AU71WcpdR2hjzL6zMi4ivH4WRAfj+fcnDpr72Tg aNcTV5dnx0dOUiwSzFr7PGyVZgcACcqCUloIvw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Building with clang for a 32-bit architecture runs over the stack frame limit in the setkey function: drivers/crypto/ccree/cc_cipher.c:318:12: error: stack frame size of 1152 bytes in function 'cc_cipher_setkey' [-Werror,-Wframe-larger-than=] The problem is that there are two large variables: the temporary 'tmp' array and the SHASH_DESC_ON_STACK() declaration. Moving the first into the block in which it is used reduces the total frame size to 768 bytes, which seems more reasonable and is under the warning limit. Fixes: 63ee04c8b491 ("crypto: ccree - add skcipher support") Signed-off-by: Arnd Bergmann --- drivers/crypto/ccree/cc_cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index d9c17078517b..0abcdc224ab0 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -321,7 +321,6 @@ static int cc_cipher_setkey(struct crypto_skcipher *sktfm, const u8 *key, struct crypto_tfm *tfm = crypto_skcipher_tfm(sktfm); struct cc_cipher_ctx *ctx_p = crypto_tfm_ctx(tfm); struct device *dev = drvdata_to_dev(ctx_p->drvdata); - u32 tmp[DES3_EDE_EXPKEY_WORDS]; struct cc_crypto_alg *cc_alg = container_of(tfm->__crt_alg, struct cc_crypto_alg, skcipher_alg.base); @@ -347,6 +346,7 @@ static int cc_cipher_setkey(struct crypto_skcipher *sktfm, const u8 *key, * HW does the expansion on its own. */ if (ctx_p->flow_mode == S_DIN_to_DES) { + u32 tmp[DES3_EDE_EXPKEY_WORDS]; if (keylen == DES3_EDE_KEY_SIZE && __des3_ede_setkey(tmp, &tfm->crt_flags, key, DES3_EDE_KEY_SIZE)) { -- 2.20.0