Skip to content

Commit c1a0671

Browse files
rust: task: use safe current! macro
Refactor the `Task::pid_in_current_ns()` to use the safe abstraction `current!()` instead of the unsafe `bindings::get_current()` binding. Signed-off-by: Antonio Hickey <[email protected]>
1 parent 8f7e376 commit c1a0671

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rust/kernel/task.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl Task {
164164
/// Returns the given task's pid in the current pid namespace.
165165
pub fn pid_in_current_ns(&self) -> Pid {
166166
// SAFETY: Calling `task_active_pid_ns` with the current task is always safe.
167-
let namespace = unsafe { bindings::task_active_pid_ns(bindings::get_current()) };
167+
let namespace = unsafe { bindings::task_active_pid_ns(current!()) };
168168
// SAFETY: We know that `self.0.get()` is valid by the type invariant.
169169
unsafe { bindings::task_tgid_nr_ns(self.0.get(), namespace) }
170170
}

0 commit comments

Comments
 (0)