btrfs-progs: crc32: use fallback implementation for unaligned buffers

ASAN reports that at some point the crc function gets an unaligned
buffer. It's the optimized intel version that casts char to ulong, the
buffer is the embedded filename in the directory items.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-11-07 13:58:51 +01:00
parent 0bd0d9c062
commit 92847b5cd6
1 changed files with 4 additions and 0 deletions

View File

@ -218,5 +218,9 @@ u32 __crc32c_le(u32 crc, unsigned char const *data, size_t length)
u32 crc32c_le(u32 crc, unsigned char const *data, size_t length)
{
/* Use by-byte access for unaligned buffers */
if ((unsigned long)data % sizeof(unsigned long))
return __crc32c_le(crc, data, length);
return crc_function(crc, data, length);
}