-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential unsound casting from volatile_register::RW
to the wrapped type
#485
Comments
Yep, you're right. In practice this is very unlikely to lead to any issues but in principle volatile_register should add a |
2 tasks
volatile-register v0.2.2 is now out, it adds |
adamgreig
added a commit
that referenced
this issue
Nov 4, 2023
github-merge-queue bot
pushed a commit
that referenced
this issue
Nov 4, 2023
cortex-m: update to volatile-register 0.2.2, fixes #485
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I am wondering whether the casting here is unsound:
cortex-m/src/peripheral/scb.rs
Lines 172 to 174 in 1746a63
Based on the definition, the wrapper struct
volatile_register::RW
(let me abbreviate it asvr
here) didn't have stable layout, andrustc
would preserve the right to insert padding or reorder the structure.vr<u32>
should be declared astransparent
; otherwise, casting it tou32
could lead to UB such as uninitialized memory exposure toptr::read_volatile
.The text was updated successfully, but these errors were encountered: