Kernel: Make Process::current() return a Process& instead of Process*

This has several benefits:
1) We no longer just blindly derefence a null pointer in various places
2) We will get nicer runtime error messages if the current process does
turn out to be null in the call location
3) GCC no longer complains about possible nullptr dereferences when
compiling without KUBSAN
This commit is contained in:
Idan Horowitz 2021-08-19 22:45:07 +03:00 committed by Andreas Kling
commit cf271183b4
Notes: sideshowbarker 2024-07-18 05:28:05 +09:00
26 changed files with 142 additions and 141 deletions

View file

@ -47,7 +47,7 @@ KResultOr<FlatPtr> Process::sys$fcntl(int fd, int cmd, u32 arg)
case F_GETLK:
return description->get_flock(Userspace<flock*>(arg));
case F_SETLK:
return description->apply_flock(*Process::current(), Userspace<const flock*>(arg));
return description->apply_flock(Process::current(), Userspace<const flock*>(arg));
default:
return EINVAL;
}