diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-01-23 05:41:16 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-01-23 05:41:20 +0400 |
commit | 8a89e7f388f708243e5596911c2e17ebf29d80ab (patch) | |
tree | e98aa02c3c931212399fc41bf222d5ebf8d0af5a /blobmsg.h | |
parent | f15ceb8ced4a88f3a4c30f6b45cf52691f4c1a5f (diff) |
blob/blobmsg: use 32 bit load/store for 64 bit access, unaligned attributes cause data corruption on ARM
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'blobmsg.h')
-rw-r--r-- | blobmsg.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -180,7 +180,10 @@ static inline uint32_t blobmsg_get_u32(struct blob_attr *attr) static inline uint64_t blobmsg_get_u64(struct blob_attr *attr) { - return be64_to_cpu(*(uint64_t *) blobmsg_data(attr)); + uint32_t *ptr = blobmsg_data(attr); + uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32; + tmp |= be32_to_cpu(ptr[1]); + return tmp; } static inline char *blobmsg_get_string(struct blob_attr *attr) |