[PATCH v2] crypto: reduce minimum alignment of on-stack structures
Eric Biggers
ebiggers at kernel.org
Fri Jan 8 16:16:36 EST 2021
On Fri, Jan 08, 2021 at 06:17:06PM +0100, Ard Biesheuvel wrote:
> diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
> index 6a733b171a5d..aa133dc3bf39 100644
> --- a/include/crypto/skcipher.h
> +++ b/include/crypto/skcipher.h
> @@ -128,7 +128,7 @@ struct skcipher_alg {
> MAX_SYNC_SKCIPHER_REQSIZE + \
> (!(sizeof((struct crypto_sync_skcipher *)1 == \
> (typeof(tfm))1))) \
> - ] CRYPTO_MINALIGN_ATTR; \
> + ] __aligned(ARCH_SLAB_MINALIGN); \
> struct skcipher_request *name = (void *)__##name##_desc
>
Are you sure this is okay? __alignof__(struct skcipher_request) will still be
CRYPTO_MINALIGN_ATTR, since it contains a field with that alignment. So
technically isn't the full alignment still needed, as the compiler can assume
that struct skcipher_request is CRYPTO_MINALIGN_ATTR-aligned?
- Eric
More information about the linux-arm-kernel
mailing list