Re: [PATCH v2] crypto, dm: LLVMLinux: Remove VLAIS usage from dm-crypt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/06/14 01:46, Milan Broz wrote:
On 09/06/2014 01:02 AM, behanw@xxxxxxxxxxxxxxxxxx wrote:
From: Jan-Simon Möller <dl9pf@xxxxxx>

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.
Well, if clang (or C99 code) is now preferred for kernel, why not.

Just please commit the patch series en bloc (together with the patches
removing VLAIS from crypto code you posted to cryptoapi list).
They seemed more separate than that. However, happy to post them as a patch set.

-	struct {
-		struct shash_desc desc;
-		char ctx[crypto_shash_descsize(lmk->hash_tfm)];
-	} sdesc;
+	char sdesc[sizeof(struct shash_desc) +
+		crypto_shash_descsize(lmk->hash_tfm)] CRYPTO_MINALIGN_ATTR;
+	struct shash_desc *desc = (struct shash_desc *)sdesc;
TBH, this looks even more uglier that the previous code :-)
I'm not claiming it's prettier. Merely C99. :)

(But tglx already complained on different patch and I fully agree that crypto code
should not use this kind of construction in the first place...
It would be very nice to introduce at least some macro hiding these crazy
stack allocations later.)
I actually agree with you and tglx. Will fix.

As I said to tglx, we were asked not to hide things with macro magic in some of our non-crypto VLAIS removal patches. Happy to use macros in this case.

Thanks,

Behan

--
Behan Webster
behanw@xxxxxxxxxxxxxxxxxx

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux