Skip to content

Commit f49a54b

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 f3bc6f9 commit f49a54b

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
@@ -169,7 +169,7 @@ impl Task {
169169
/// Returns the given task's pid in the current pid namespace.
170170
pub fn pid_in_current_ns(&self) -> Pid {
171171
// SAFETY: Calling `task_active_pid_ns` with the current task is always safe.
172-
let namespace = unsafe { bindings::task_active_pid_ns(bindings::get_current()) };
172+
let namespace = unsafe { bindings::task_active_pid_ns(current!().as_raw()) };
173173
// SAFETY: We know that `self.raw()` is valid by the type invariant.
174174
unsafe { bindings::task_tgid_nr_ns(self.as_raw(), namespace) }
175175
}

0 commit comments

Comments
 (0)