[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190523162004.GC23070@redhat.com>
Date: Thu, 23 May 2019 18:20:05 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Christian Brauner <christian@...uner.io>
Cc: viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-api@...r.kernel.org,
torvalds@...ux-foundation.org, fweimer@...hat.com,
jannh@...gle.com, tglx@...utronix.de, arnd@...db.de,
shuah@...nel.org, dhowells@...hat.com, tkjos@...roid.com,
ldv@...linux.org, miklos@...redi.hu, linux-alpha@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-ia64@...r.kernel.org,
linux-m68k@...ts.linux-m68k.org, linux-mips@...r.kernel.org,
linux-parisc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-s390@...r.kernel.org, linux-sh@...r.kernel.org,
sparclinux@...r.kernel.org, linux-xtensa@...ux-xtensa.org,
linux-arch@...r.kernel.org, linux-kselftest@...r.kernel.org,
x86@...nel.org
Subject: Re: [PATCH v2 1/2] open: add close_range()
On 05/23, Christian Brauner wrote:
>
> +int __close_range(struct files_struct *files, unsigned fd, unsigned max_fd)
> +{
> + unsigned int cur_max;
> +
> + if (fd > max_fd)
> + return -EINVAL;
> +
> + rcu_read_lock();
> + cur_max = files_fdtable(files)->max_fds;
> + rcu_read_unlock();
> +
> + /* cap to last valid index into fdtable */
> + max_fd = max(max_fd, (cur_max - 1));
^^^
Hmm. min() ?
Oleg.
Powered by blists - more mailing lists