From patchwork Thu Mar 14 09:09:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160319 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15259648jad; Thu, 14 Mar 2019 02:10:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7X9s7zPabnJ7yHuURLVDyHe+/V3lxu7ZPcxyhmsmiuhho2TWhNMZ8Ef0qEIeMAZakJ1N0 X-Received: by 2002:a63:e80d:: with SMTP id s13mr15197360pgh.379.1552554623190; Thu, 14 Mar 2019 02:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552554623; cv=none; d=google.com; s=arc-20160816; b=J7HcO8v97VVmLTRiQqGGqxf25jw1JBEK3+zv3tAlNc1Zi9uGiWdQjj4mtrtTpu4F/f f80Q1Yj+xq4bKxlgHtH91C08vn7G7cKeUjtPRjIYji2Sqehl8egClRTOxtCqza7v+gxA 1hHHODy1YLH6NeNkiY776cUMOt/59ErFGIKhF4Tpd1lW9VI5oOgx2tkEEVSWwHyYzRSk 7XZlfcfcf1XHrc6bVp0lr7PEHHq996bOODgj7dcjk1fqpJ+CuahNpOrEfnzCdqJnYgve 9orGQEw6c52mkKizkF2etV3pFksWEpaTkq5bWmVxI6E0n2QkvJj107hu1srjNWmSB+0L REfQ== 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 u66si12973272pfu.54.2019.03.14.02.10.22; Thu, 14 Mar 2019 02:10:23 -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 S1726797AbfCNJKV (ORCPT + 31 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 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(-) -- 2.20.0 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)) {