[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190523163439.56ucetlt6duvnhdj@brauner.io>
Date: Thu, 23 May 2019 18:34:41 +0200
From: Christian Brauner <christian@...uner.io>
To: Oleg Nesterov <oleg@...hat.com>
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 Thu, May 23, 2019 at 06:20:05PM +0200, Oleg Nesterov wrote:
> 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() ?
Yes, thanks! Massive brainf*rt on my end, sorry.
Christian
Powered by blists - more mailing lists