Require erase address to be aligned to page size

This commit is contained in:
chemicstry 2022-07-14 21:21:46 +03:00
parent 5a265661bb
commit f0027c9fe0

View file

@ -72,7 +72,7 @@ impl<'d> Flash<'d> {
if to < from || to as usize > FLASH_END {
return Err(Error::Size);
}
if ((to - from) as usize % ERASE_SIZE) != 0 {
if (from as usize % ERASE_SIZE) != 0 || (to as usize % ERASE_SIZE) != 0 {
return Err(Error::Unaligned);
}