On 07/28, Christian Brauner wrote:
>
> +static struct pid *pidfd_get_pid(unsigned int fd)
> +{
> +     struct fd f;
> +     struct pid *pid;
> +
> +     f = fdget(fd);
> +     if (!f.file)
> +             return ERR_PTR(-EBADF);
> +
> +     pid = pidfd_pid(f.file);
> +     if (!IS_ERR(pid))
> +             get_pid(pid);
> +
> +     fdput(f);
> +     return pid;
> +}

Agreed, this looks better than the previous version.

FWIW,

Reviewed-by: Oleg Nesterov <[email protected]>

Reply via email to