Replacing memcpy with unoptimized char copying avoids this issue, so it seems to be a misaligned read issue.
diff --git a/fs/libfs.c b/fs/libfs.c index 77709c5923a8..f99e265b6d81 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -786,6 +786,8 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, const void *from, size_t available) { loff_t pos = *ppos; + char *p1, *p2; + size_t i;
if (pos < 0) return -EINVAL; @@ -798,8 +800,14 @@ ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, (unsigned long long)available, (unsigned long long)pos, (unsigned long long)count); + + p1 = to; + p2 = from + pos; + + for (i = 0; i < count; i++,p1++,p2++) + *p1 = *p2;
- memcpy(to, from + pos, count); + //memcpy(to, from + pos, count); *ppos = pos + count;
return count;
This is called from acpi_data_show() which does:
rc = memory_read_from_buffer(buf, count, &offset, base, data_attr->attr.size);
On a second read, the contents of offset is odd making base + offset odd on the source address of a memcpy(). I thought memcpy could handle that.
Replacing memcpy with unoptimized char copying avoids this issue, so it seems to be a misaligned read issue.
diff --git a/fs/libfs.c b/fs/libfs.c .f99e265b6d81 100644 read_from_ buffer( void *to, size_t count, loff_t *ppos,
const void *from, size_t available)
index 77709c5923a8.
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -786,6 +786,8 @@ ssize_t memory_
{
loff_t pos = *ppos;
+ char *p1, *p2;
+ size_t i;
if (pos < 0)
return -EINVAL; read_from_ buffer( void *to, size_t count, loff_t *ppos,
(unsigned long long)available,
(unsigned long long)pos,
(unsigned long long)count);
@@ -798,8 +800,14 @@ ssize_t memory_
+
+ p1 = to;
+ p2 = from + pos;
+
+ for (i = 0; i < count; i++,p1++,p2++)
+ *p1 = *p2;
- memcpy(to, from + pos, count);
+ //memcpy(to, from + pos, count);
*ppos = pos + count;
return count;
This is called from acpi_data_show() which does:
rc = memory_ read_from_ buffer( buf, count, &offset, base,
data_ attr->attr. size);
On a second read, the contents of offset is odd making base + offset odd on the source address of a memcpy(). I thought memcpy could handle that.