mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/mtd_flashpage: require read source & destination alignment
This commit is contained in:
parent
0b79ae3524
commit
127b46eea3
@ -44,6 +44,12 @@ static int _read(mtd_dev_t *dev, void *buf, uint32_t addr, uint32_t size)
|
||||
|
||||
(void)dev;
|
||||
|
||||
#ifndef CPU_HAS_UNALIGNED_ACCESS
|
||||
if (addr % sizeof(uword_t)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
uword_t dst_addr = addr;
|
||||
memcpy(buf, (void *)dst_addr, size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user