OSDN Git Service

crypto: ccree - reduce kernel stack usage with clang
authorArnd Bergmann <arnd@arndb.de>
Thu, 14 Mar 2019 09:09:44 +0000 (10:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:50:33 +0000 (14:50 +0100)
commitb6e63c1862ce349edbb5702d130606c21cee1c13
treeb59179790f8a5a85fe091018174a973fce5a2a7c
parent5bb4a32a720350cc0074d885fbcfc3db51cc0e3e
crypto: ccree - reduce kernel stack usage with clang

[ Upstream commit 5db46ac29a6797541943d3c4081821747e342732 ]

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 <arnd@arndb.de>
Acked-By: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/ccree/cc_cipher.c