From: Christian Brauner Date: Thu, 3 Apr 2025 14:09:02 +0000 (+0200) Subject: pidfd: remove unneeded NULL check from pidfd_prepare() X-Git-Tag: v6.16-rc1~220^2~7^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b090949c9989a35c74aa2cd7fee6670b79019cd;p=thirdparty%2Flinux.git pidfd: remove unneeded NULL check from pidfd_prepare() None of the caller actually pass a NULL pid in there. Link: https://lore.kernel.org/r/20250403-work-pidfd-fixes-v1-2-a123b6ed6716@kernel.org Reviewed-by: Oleg Nesterov Signed-off-by: Christian Brauner --- diff --git a/kernel/fork.c b/kernel/fork.c index c4b26cd8998b8..182ec2e9087d9 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2110,7 +2110,7 @@ int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret) { bool thread = flags & PIDFD_THREAD; - if (!pid || !pid_has_task(pid, thread ? PIDTYPE_PID : PIDTYPE_TGID)) + if (!pid_has_task(pid, thread ? PIDTYPE_PID : PIDTYPE_TGID)) return -EINVAL; return __pidfd_prepare(pid, flags, ret);