In the following code:
|
unsafe impl<T, const ID: u64> WorkItemPointer<ID> for Pin<KBox<T>> |
|
where |
|
T: WorkItem<ID, Pointer = Self>, |
|
T: HasWork<T, ID>, |
|
{ |
|
unsafe extern "C" fn run(ptr: *mut bindings::work_struct) { |
|
// The `__enqueue` method always uses a `work_struct` stored in a `Work<T, ID>`. |
|
let ptr = ptr.cast::<Work<T, ID>>(); |
|
// SAFETY: This computes the pointer that `__enqueue` got from `Arc::into_raw`. |
|
let ptr = unsafe { T::work_container_of(ptr) }; |
|
// SAFETY: This pointer comes from `Arc::into_raw` and we've been given back ownership. |
|
let boxed = unsafe { KBox::from_raw(ptr) }; |
|
// SAFETY: The box was already pinned when it was enqueued. |
|
let pinned = unsafe { Pin::new_unchecked(boxed) }; |
|
|
WorkItemPointer implementation for Pin<KBox<T>> incorrectly refers to Arc (most likely the safety comments were copied from the Arc implementation). As this implementation uses KBox, safety comments should refer to KBox properly instead of Arc.
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://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.
In the following code:
linux/rust/kernel/workqueue.rs
Lines 885 to 899 in b4e0758
WorkItemPointerimplementation forPin<KBox<T>>incorrectly refers toArc(most likely the safety comments were copied from theArcimplementation). As this implementation usesKBox, safety comments should refer toKBoxproperly instead ofArc.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 aLink:tag to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.