1
0
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:
Benjamin Valentin 2021-02-23 09:47:58 +01:00
parent 0b79ae3524
commit 127b46eea3

View File

@ -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);