summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/compression.c5
-rw-r--r--fs/btrfs/hash.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index a59ff5a8bb..b1b4498fba 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -9,6 +9,7 @@
#include "btrfs.h"
#include <linux/lzo.h>
#include <u-boot/zlib.h>
+#include <asm/unaligned.h>
static u32 decompress_lzo(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen)
{
@@ -19,7 +20,7 @@ static u32 decompress_lzo(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen)
if (clen < 4)
return -1;
- tot_len = le32_to_cpu(*(u32 *) cbuf);
+ tot_len = le32_to_cpu(get_unaligned((u32 *)cbuf));
cbuf += 4;
clen -= 4;
tot_len -= 4;
@@ -32,7 +33,7 @@ static u32 decompress_lzo(const u8 *cbuf, u32 clen, u8 *dbuf, u32 dlen)
res = 0;
while (tot_len > 4) {
- in_len = le32_to_cpu(*(u32 *) cbuf);
+ in_len = le32_to_cpu(get_unaligned((u32 *)cbuf));
cbuf += 4;
clen -= 4;
diff --git a/fs/btrfs/hash.c b/fs/btrfs/hash.c
index f8a50e532a..cde3abd3df 100644
--- a/fs/btrfs/hash.c
+++ b/fs/btrfs/hash.c
@@ -8,6 +8,7 @@
#include "btrfs.h"
#include <u-boot/crc.h>
+#include <asm/unaligned.h>
static u32 btrfs_crc32c_table[256];
@@ -34,5 +35,5 @@ u32 btrfs_csum_data(char *data, u32 seed, size_t len)
void btrfs_csum_final(u32 crc, void *result)
{
- *((u32 *) result) = cpu_to_le32(~crc);
+ put_unaligned(cpu_to_le32(~crc), (u32 *)result);
}