Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/blob.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-23 05:41:16 +0400
committerFelix Fietkau <nbd@openwrt.org>2013-01-23 05:41:20 +0400
commit8a89e7f388f708243e5596911c2e17ebf29d80ab (patch)
treee98aa02c3c931212399fc41bf222d5ebf8d0af5a /blob.h
parentf15ceb8ced4a88f3a4c30f6b45cf52691f4c1a5f (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 'blob.h')
-rw-r--r--blob.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/blob.h b/blob.h
index a8ddce9..557899d 100644
--- a/blob.h
+++ b/blob.h
@@ -191,8 +191,10 @@ blob_get_u32(const struct blob_attr *attr)
static inline uint64_t
blob_get_u64(const struct blob_attr *attr)
{
- uint64_t *tmp = (uint64_t*)attr->data;
- return be64_to_cpu(*tmp);
+ uint32_t *ptr = blob_data(attr);
+ uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32;
+ tmp |= be32_to_cpu(ptr[1]);
+ return tmp;
}
static inline int8_t