-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
The function UnlockedFlash::write (and write_native) let you write to arbitrary memory locations, bypassing Rust's ownership checks, but are currently not marked as unsafe.
I recently made some changes to some code that was using this function and accidentally ended up passing an address that was effectively a pointer to the stack rather than a pointer to flash. Needles to say, this didn't end well.
I feel like these functions as they are, should be marked as unsafe, since they rely on the caller to check that the address to be written is (a) part of flash and (b) not part of the program currently being executed.
A safe alternative API would be to accept an &mut [u8]
for the part of flash that is to be written.
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels