diff options
author | Jan-Simon Möller <dl9pf@gmx.de> | 2012-07-02 13:48:30 +0200 |
---|---|---|
committer | Behan Webster <behanw@converseincode.com> | 2014-03-31 00:07:18 -0700 |
commit | 3be2f96972a2d007fcb34914e1dc4b814892380e (patch) | |
tree | 5383edf1ac26e570778346afddeb14911d3b2f80 /crypto | |
parent | ca7c937cb8d2c85ebada9cdd2b5070d1e731f3dc (diff) |
crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c
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.
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Cc: pageexec@freemail.hu
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/testmgr.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 77955507f6f..81519ca5847 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1663,16 +1663,17 @@ static int alg_test_crc32c(const struct alg_test_desc *desc, } do { - struct { - struct shash_desc shash; - char ctx[crypto_shash_descsize(tfm)]; - } sdesc; + char sdesc[sizeof(struct shash_desc) + + crypto_shash_descsize(tfm) + + CRYPTO_MINALIGN] CRYPTO_MINALIGN_ATTR; + struct shash_desc *shash = (struct shash_desc *)sdesc; + u32 *ctx = (u32 *)shash_desc_ctx(shash); - sdesc.shash.tfm = tfm; - sdesc.shash.flags = 0; + shash->tfm = tfm; + shash->flags = 0; - *(u32 *)sdesc.ctx = le32_to_cpu(420553207); - err = crypto_shash_final(&sdesc.shash, (u8 *)&val); + *ctx = le32_to_cpu(420553207); + err = crypto_shash_final(shash, (u8 *)&val); if (err) { printk(KERN_ERR "alg: crc32c: Operation failed for " "%s: %d\n", driver, err); |