Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: atomic: Update a safety comment in impl of `fetch_add()`

The safety comment used in the implementation of `fetch_add()` could be
read as just saying something it is true without justifying it. Update
the safety comment to include justification.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: Boqun Feng <boqun@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260220-atomic-sub-v3-3-e63cbed1d2aa@kernel.org
Link: https://patch.msgid.link/20260303201701.12204-14-boqun@kernel.org

authored by

Andreas Hindborg and committed by
Peter Zijlstra
b91d5d4b 0b864375

+1 -1
+1 -1
rust/kernel/sync/atomic/internal.rs
··· 337 337 /// Atomically updates `*a` to `(*a).wrapping_add(v)`, and returns the value of `*a` 338 338 /// before the update. 339 339 fn fetch_add[acquire, release, relaxed](a: &AtomicRepr<Self>, v: Self::Delta) -> Self { 340 - // SAFETY: `a.as_ptr()` is valid and properly aligned. 340 + // SAFETY: `a.as_ptr()` guarantees the returned pointer is valid and properly aligned. 341 341 unsafe { bindings::#call(v, a.as_ptr().cast()) } 342 342 } 343 343