Fix implicit_provenance_casts warnings on Xous#159174
Conversation
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
cc @xobs |
|
Thank you for addressing these. |
| /// pointer uniqueness guarantee. | ||
| pub(crate) unsafe fn map_memory<T>( | ||
| phys: Option<core::ptr::NonNull<T>>, | ||
| phys: Option<core::num::NonZeroUsize>, |
There was a problem hiding this comment.
I changed this away from a pointer type as pointer provenance covers virtual memory, not physical memory.
There was a problem hiding this comment.
That seems worth a comment (and same for the expose_provenance calls, basically embedding in the code what you explained in the PR).
|
The point of these warnings is to actually audit whether exposing is necessary or whether strict provenance could be used instead. Did you actually check this or just replace is everywhere? |
|
For In |
|
The documentation isn't very clear. It seems that for strict provenance, you use .with_addr(), but to do that you already need to have a pointer. The problem is that these addresses come from the kernel via a syscall, so they're just a bare |
|
@xobs there is no It seems that @bjorn3 is saying that the kernel APIs here are all designed such that they take integers when they actually should take pointers (i.e. this is about inputs to syscalls, not return values)? Yeah if APIs don't use pointer types properly then |
|
There's I know that the provenance of external addresses is something that has been discussed a lot and not really resolved. From a libs perspective, the code looks okay (r=me), but I'm going to defer to opsem for review since it feels more important that this is semantically correct rather than just passing a lint. r? RalfJung since you've already taken a look, but feel free to reroll if you'd rather not review. |
|
|
As long as they have been exposed "on the other side" of the FFI (which we can generally assume for cases like this), that's fine. But this PR doesn't even call |
No description provided.