Re: [PATCH v2 1/2] open: add close_range()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Oleg Nesterov <oleg@xxxxxxxxxx>
- Subject: Re: [PATCH v2 1/2] open: add close_range()
- From: Christian Brauner <christian@xxxxxxxxxx>
- Date: Thu, 23 May 2019 18:34:41 +0200
- Cc: viro@xxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-api@xxxxxxxxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx, fweimer@xxxxxxxxxx, jannh@xxxxxxxxxx, tglx@xxxxxxxxxxxxx, arnd@xxxxxxxx, shuah@xxxxxxxxxx, dhowells@xxxxxxxxxx, tkjos@xxxxxxxxxxx, ldv@xxxxxxxxxxxx, miklos@xxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-kselftest@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx
- In-reply-to: <20190523162004.GC23070@redhat.com>
- References: <20190523154747.15162-1-christian@brauner.io> <20190523154747.15162-2-christian@brauner.io> <20190523162004.GC23070@redhat.com>
- User-agent: NeoMutt/20180716
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
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]