[dm-devel] [PATCH] Remove VLAIS usage from dm-crypt

Milan Broz mbroz at redhat.com
Sat Nov 3 19:30:08 UTC 2012


On 10/30/2012 07:15 PM, Behan Webster wrote:
> From: Jan-Simon Möller <dl9pf at gmx.de>
> 
> The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
> precludes the use of compilers which don't implement VLAIS (for instance the
> Clang compiler). This patch instead allocates the appropriate amount of memory
> using an char array.

The dmcrypt code should use the same code practices as crypto API.

Apparently, your approach was not accepted there

http://article.gmane.org/gmane.linux.kernel/1386451
http://article.gmane.org/gmane.linux.kernel.cryptoapi/7993

> +	char sdesc[sizeof(struct shash_desc)
> +		+ crypto_shash_descsize(lmk->hash_tfm)
> +		+ CRYPTO_MINALIGN] CRYPTO_MINALIGN_ATTR;
> +	struct shash_desc *desc = (struct shash_desc *)sdesc;

I would like to see kenrel compilable by Clang but obfuscating the code
this way is perhaps not the ideal way.

Until it is accepted in crypto layer, NACK.

Milan




More information about the dm-devel mailing list