Skip to contentSkip to conversation

crypto: LLVMLinux: aligned-attribute.patch

PATCH New [email protected] 1 participant 1 message Mar 27, 2014 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: LLVMLinux: aligned-attribute.patch

From: Mark Charlebois <[email protected]>

__attribute__((aligned)) applies the default alignment for the largest scalar type for the target ABI. gcc allows it to be applied inline to a defined type. Clang only allows it to be applied to a type definition (PR11071).

Making it into 2 lines makes it more readable and works with both compilers.

Author: Mark Charlebois <[email protected]>

---
 crypto/shash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/shash.c +2 -1
index 929058a..47c7139 100644
@@ -67,7 +67,8 @@ EXPORT_SYMBOL_GPL(crypto_shash_setkey);
 static inline unsigned int shash_align_buffer_size(unsigned len,
 						   unsigned long mask)
 {
-	return len + (mask & ~(__alignof__(u8 __attribute__ ((aligned))) - 1));
+	typedef u8 __attribute__ ((aligned)) u8_aligned;
+	return len + (mask & ~(__alignof__(u8_aligned) - 1));
 }
 
 static int shash_update_unaligned(struct shash_desc *desc, const u8 *data,
Signature · 1 line
1.8.3.2