Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN

From: Herbert Xu
Date: Fri Apr 15 2022 - 04:12:32 EST


On Fri, Apr 15, 2022 at 10:05:21AM +0200, Ard Biesheuvel wrote:
>
> I guess that should be fixable. GIven that this is about padding
> rather than alignment, we could do something like
>
> struct crypto_request {
> union {
> struct {
> ... fields ...
> };
> u8 __padding[ARCH_DMA_MINALIGN];
> };
> void __ctx[] __align(CRYPTO_MINALIGN);
> };
>
> And then hopefully, we can get rid of the padding once we fix drivers
> doing non-cache coherent inbound DMA into those structures.

Sorry, I don't think this works. kmalloc can still return something
that's not ARCH_DMA_MINALIGN-aligned, and therefore __ctx won't be
aligned correctly.

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt