[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bda66faa-f52d-215d-f21b-763593b30f91@embeddedor.com>
Date: Fri, 23 Mar 2018 14:09:46 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: "David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [RESEND] SHASH_DESC_ON_STACK macro
Hi Herbert,
There is an ongoing effort to remove all VLAs from the code base [1] and
while working on that I came across the following macro at
include/crypto/hash.h:154:
#define SHASH_DESC_ON_STACK(shash, ctx) \
char __##shash##_desc[sizeof(struct shash_desc) + \
crypto_shash_descsize(ctx)] CRYPTO_MINALIGN_ATTR; \
struct shash_desc *shash = (struct shash_desc *)__##shash##_desc
Currently, this macro is being used in 46 different places.
I wonder how big can tfm->descsize can get?
Do you think it is feasible to replace the call to crypto_shash_descsize
with a constant value and get rid of 46 VLA warnings?
I have sent some patches to replace the use of this macro with dynamic
memory allocation instead, but it seems that this is not a suitable
solution for all cases due to performance issues.
[1] https://lkml.org/lkml/2018/3/7/621
I'd really appreciate any feedback.
Thanks
--
Gustavo
Powered by blists - more mailing lists