linux/drivers/crypto/sunxi-ss
Arnd Bergmann 8d3bcb9900 crypto: sun4i-ss - reduce stack usage
After the latest addition, the stack usage of sun4i_ss_cipher_poll
grew beyond the warning limit when KASAN is enabled:

drivers/crypto/sunxi-ss/sun4i-ss-cipher.c:118:12: error: stack frame size of 1152 bytes in function 'sun4i_ss_cipher_poll' [-Werror,-Wframe-larger-than=]
static int sun4i_ss_cipher_poll(struct skcipher_request *areq)

Reduce it in three ways:

- split out the new code into a separate function so its stack
  usage can overlap that of the sun4i_ss_opti_poll() code path
- mark both special cases as noinline_for_stack, which should
  ideally result in a tail call that frees the rest of the
  stack
- move the buf and obuf variables into the code blocks in
  which they are used.

The three separate functions now use 144, 640 and 304 bytes of kernel
stack, respectively.

Fixes: 0ae1f46c55 ("crypto: sun4i-ss - fallback when length is not multiple of blocksize")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-06-27 14:28:01 +08:00
..
Makefile crypto: sun4i-ss - support the Security System PRNG 2017-07-18 17:50:55 +08:00
sun4i-ss-cipher.c crypto: sun4i-ss - reduce stack usage 2019-06-27 14:28:01 +08:00
sun4i-ss-core.c crypto: sun4i-ss - fallback when length is not multiple of blocksize 2019-04-25 15:38:13 +08:00
sun4i-ss-hash.c crypto: sun4i-ss - Fix invalid calculation of hash end 2019-04-25 15:38:12 +08:00
sun4i-ss-prng.c crypto: sun4i_ss_prng - convert lock to _bh in sun4i_ss_prng_generate 2018-02-08 22:38:14 +11:00
sun4i-ss.h crypto: sun4i-ss - fallback when length is not multiple of blocksize 2019-04-25 15:38:13 +08:00