diff mbox

btrfs: properly access unaligned checksum buffer

Message ID 20110318225643.GY17108@twin.jikos.cz (mailing list archive)
State New, archived
Headers show

Commit Message

David Sterba March 18, 2011, 10:56 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e1aa8d6..80a6830 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -29,6 +29,7 @@ 
 #include <linux/crc32c.h>
 #include <linux/slab.h>
 #include <linux/migrate.h>
+#include <asm/unaligned.h>
 #include "compat.h"
 #include "ctree.h"
 #include "disk-io.h"
@@ -198,7 +199,7 @@  u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)

 void btrfs_csum_final(u32 crc, char *result)
 {
-       *(__le32 *)result = ~cpu_to_le32(crc);
+       put_unaligned_le32(~crc, result);
 }

 /*