You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We do not allow new unsafe comments to enter the codebase without a // SAFETY comment. Nowadays, we use Clippy's undocumented_unsafe_blocks to check for that. However, some // SAFETY: TODO. comments remain (please see the rust-next branch). The issue is about cleaning those up.
It is not needed to fix all the comments at once (in fact, a given area/module/file should be cleaned independently), so this is a set of "good first issues". Please note that some of the comments may be easier or harder to figure out than others.
This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://rust-for-linux.com/contributing for details.
First of all, remove the unsafe keyword and compile again so that the compiler tells you 1) what subexpressions need a block (sometimes there is more than one) and 2) what is the reason unsafe is needed (e.g. the simplest case being a FFI call).
There is an allow-by-default unsafe_code lint which is designed for auditing unsafe usage.
Activity
nbdd0121 commentedon Jun 4, 2021
There is an allow-by-default
unsafe_codelint which is designed for auditing unsafe usage.LeSeulArtichaut commentedon Aug 1, 2021
Here's a Python script to find undocumented
unsafeblocks, borrowing logic fromrust-lang/rust's tidy checks:If placed in the
rust/folder, it will check every file in thekernelcrate.rust: kernel: add missing safety comments
rust: kernel: add missing safety comments
rust: kernel: add missing safety comments
rust: kernel: add missing safety comments
[-]rust: kernel: add missing `// SAFETY` comments[/-][+]rust: add missing `// SAFETY` comments[/+][-]rust: add missing `// SAFETY` comments[/-][+]Add missing `// SAFETY` comments[/+]rust: enable `clippy::undocumented_unsafe_blocks` lint
rust: enable `clippy::undocumented_unsafe_blocks` lint
108 remaining items
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example
rust: Add missing SAFETY documentation for `ARef` example