From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
torvalds@linux-foundation.org, fweimer@redhat.com,
jannh@google.com, tglx@linutronix.de, arnd@arndb.de,
shuah@kernel.org, dhowells@redhat.com, tkjos@android.com,
ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org,
linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org,
x86@kernel.org
Subject: Re: [PATCH v2 1/2] open: add close_range()
Date: Thu, 23 May 2019 18:20:05 +0200 [thread overview]
Message-ID: <20190523162004.GC23070@redhat.com> (raw)
In-Reply-To: <20190523154747.15162-2-christian@brauner.io>
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.
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
torvalds@linux-foundation.org, fweimer@redhat.com,
jannh@google.com, tglx@linutronix.de, arnd@arndb.de,
shuah@kernel.org, dhowells@redhat.com, tkjos@android.com,
ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org,
linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org,
x86@kernel.org
Subject: Re: [PATCH v2 1/2] open: add close_range()
Date: Thu, 23 May 2019 16:20:05 +0000 [thread overview]
Message-ID: <20190523162004.GC23070@redhat.com> (raw)
In-Reply-To: <20190523154747.15162-2-christian@brauner.io>
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.
WARNING: multiple messages have this Message-ID (diff)
From: oleg at redhat.com (Oleg Nesterov)
Subject: [PATCH v2 1/2] open: add close_range()
Date: Thu, 23 May 2019 18:20:05 +0200 [thread overview]
Message-ID: <20190523162004.GC23070@redhat.com> (raw)
In-Reply-To: <20190523154747.15162-2-christian@brauner.io>
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.
WARNING: multiple messages have this Message-ID (diff)
From: oleg@redhat.com (Oleg Nesterov)
Subject: [PATCH v2 1/2] open: add close_range()
Date: Thu, 23 May 2019 18:20:05 +0200 [thread overview]
Message-ID: <20190523162004.GC23070@redhat.com> (raw)
Message-ID: <20190523162005.Li9TfqHgEilAq34Z07l2vtlmMH9q9C8ERE6tzbCZt7w@z> (raw)
In-Reply-To: <20190523154747.15162-2-christian@brauner.io>
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.
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org,
ldv@altlinux.org, dhowells@redhat.com,
linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org,
shuah@kernel.org, linux-arch@vger.kernel.org,
linux-s390@vger.kernel.org, miklos@szeredi.hu, x86@kernel.org,
torvalds@linux-foundation.org, linux-mips@vger.kernel.org,
linux-xtensa@linux-xtensa.org, tkjos@android.com, arnd@arndb.de,
jannh@google.com, linux-m68k@lists.linux-m68k.org,
viro@zeniv.linux.org.uk, tglx@linutronix.de,
linux-arm-kernel@lists.infradead.org, fweimer@redhat.com,
linux-parisc@vger.kernel.org, linux-api@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/2] open: add close_range()
Date: Thu, 23 May 2019 18:20:05 +0200 [thread overview]
Message-ID: <20190523162004.GC23070@redhat.com> (raw)
In-Reply-To: <20190523154747.15162-2-christian@brauner.io>
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.
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org,
ldv@altlinux.org, dhowells@redhat.com,
linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org,
shuah@kernel.org, linux-arch@vger.kernel.org,
linux-s390@vger.kernel.org, miklos@szeredi.hu, x86@kernel.org,
torvalds@linux-foundation.org, linux-mips@vger.kernel.org,
linux-xtensa@linux-xtensa.org, tkjos@android.com, arnd@arndb.de,
jannh@google.com, linux-m68k@lists.linux-m68k.org,
viro@zeniv.linux.org.uk, tglx@linutronix.de,
linux-arm-kernel@lists.infradead.org, fweimer@redhat.com,
linux-parisc@vger.kernel.org, linux-api@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/2] open: add close_range()
Date: Thu, 23 May 2019 18:20:05 +0200 [thread overview]
Message-ID: <20190523162004.GC23070@redhat.com> (raw)
In-Reply-To: <20190523154747.15162-2-christian@brauner.io>
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.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-23 16:20 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 15:47 [PATCH v2 0/2] close_range() Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` christian
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` [PATCH v2 1/2] open: add close_range() Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` christian
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 16:20 ` Oleg Nesterov [this message]
2019-05-23 16:20 ` Oleg Nesterov
2019-05-23 16:20 ` Oleg Nesterov
2019-05-23 16:20 ` Oleg Nesterov
2019-05-23 16:20 ` oleg
2019-05-23 16:20 ` Oleg Nesterov
2019-05-23 16:34 ` Christian Brauner
2019-05-23 16:34 ` Christian Brauner
2019-05-23 16:34 ` Christian Brauner
2019-05-23 16:34 ` Christian Brauner
2019-05-23 16:34 ` christian
2019-05-23 16:34 ` Christian Brauner
2019-05-26 20:20 ` Szabolcs Nagy
2019-05-26 20:20 ` Szabolcs Nagy
2019-05-26 20:20 ` Szabolcs Nagy
2019-05-26 20:20 ` Szabolcs Nagy
2019-05-26 20:20 ` nsz
2019-05-26 20:20 ` Szabolcs Nagy
2019-05-23 15:47 ` [PATCH v2 2/2] tests: add close_range() tests Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` Christian Brauner
2019-05-23 15:47 ` christian
2019-05-23 15:47 ` Christian Brauner
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 2:33 ` mpe
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 2:33 ` Michael Ellerman
2019-05-28 9:57 ` Christian Brauner
2019-05-28 9:57 ` Christian Brauner
2019-05-28 9:57 ` Christian Brauner
2019-05-28 9:57 ` Christian Brauner
2019-05-28 9:57 ` christian
2019-05-28 9:57 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190523162004.GC23070@redhat.com \
--to=oleg@redhat.com \
--cc=arnd@arndb.de \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=fweimer@redhat.com \
--cc=jannh@google.com \
--cc=ldv@altlinux.org \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=miklos@szeredi.hu \
--cc=shuah@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tkjos@android.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.