Skip to content

Commit 75ef998

Browse files
committed
rust: workqueue: fix safety comments in WorkItemPointer for Pin<KBox>
The safety comments in the impl WorkItemPointer for Pin<KBox> incorrectly refer to Arc when they should refer to KBox, since this implementation uses KBox instead of Arc. Fix the safety comments to properly reference KBox. Suggested-by: onur-ozkan <onur-ozkan@users.noreply.github.com> Link: #1233 Signed-off-by: zanni098 <zanni098@users.noreply.github.com>
1 parent 254f496 commit 75ef998

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rust/kernel/workqueue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,9 @@ where
890890
unsafe extern "C" fn run(ptr: *mut bindings::work_struct) {
891891
// The `__enqueue` method always uses a `work_struct` stored in a `Work<T, ID>`.
892892
let ptr = ptr.cast::<Work<T, ID>>();
893-
// SAFETY: This computes the pointer that `__enqueue` got from `Arc::into_raw`.
893+
// SAFETY: This computes the pointer that `__enqueue` got from `KBox::into_raw`.
894894
let ptr = unsafe { T::work_container_of(ptr) };
895-
// SAFETY: This pointer comes from `Arc::into_raw` and we've been given back ownership.
895+
// SAFETY: This pointer comes from `KBox::into_raw` and we've been given back ownership.
896896
let boxed = unsafe { KBox::from_raw(ptr) };
897897
// SAFETY: The box was already pinned when it was enqueued.
898898
let pinned = unsafe { Pin::new_unchecked(boxed) };

0 commit comments

Comments
 (0)