linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] epoll: remove unnecessary bit operation in epoll_create1 syscall
@ 2011-01-12 10:58 Namhyung Kim
  2011-01-12 14:42 ` richard -rw- weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2011-01-12 10:58 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Davide Libenzi, linux-fsdevel, linux-kernel

@flags can have O_CLOEXEC only so bitwise AND is not necessary.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 fs/eventpoll.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 8cf07242067d..2e21fb85b8b6 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1209,7 +1209,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
 	 * a file structure and a free file descriptor.
 	 */
 	error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
-				 O_RDWR | (flags & O_CLOEXEC));
+				 O_RDWR | flags);
 	if (error < 0)
 		ep_free(ep);
 
-- 
1.7.3.4.600.g982838b0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] epoll: remove unnecessary bit operation in epoll_create1 syscall
  2011-01-12 10:58 [PATCH] epoll: remove unnecessary bit operation in epoll_create1 syscall Namhyung Kim
@ 2011-01-12 14:42 ` richard -rw- weinberger
  2011-01-12 16:54   ` Davide Libenzi
  0 siblings, 1 reply; 3+ messages in thread
From: richard -rw- weinberger @ 2011-01-12 14:42 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Alexander Viro, Davide Libenzi, linux-fsdevel, linux-kernel

On Wed, Jan 12, 2011 at 11:58 AM, Namhyung Kim <namhyung@gmail.com> wrote:
> @flags can have O_CLOEXEC only so bitwise AND is not necessary.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  fs/eventpoll.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> index 8cf07242067d..2e21fb85b8b6 100644
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1209,7 +1209,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
>         * a file structure and a free file descriptor.
>         */
>        error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
> -                                O_RDWR | (flags & O_CLOEXEC));
> +                                O_RDWR | flags);

I'm strong against this.
Whenever a new flag is allowed this will explode...

>        if (error < 0)
>                ep_free(ep);
>
> --
> 1.7.3.4.600.g982838b0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] epoll: remove unnecessary bit operation in epoll_create1 syscall
  2011-01-12 14:42 ` richard -rw- weinberger
@ 2011-01-12 16:54   ` Davide Libenzi
  0 siblings, 0 replies; 3+ messages in thread
From: Davide Libenzi @ 2011-01-12 16:54 UTC (permalink / raw)
  To: richard -rw- weinberger
  Cc: Namhyung Kim, Alexander Viro, linux-fsdevel,
	Linux Kernel Mailing List

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1115 bytes --]

On Wed, 12 Jan 2011, richard -rw- weinberger wrote:

> On Wed, Jan 12, 2011 at 11:58 AM, Namhyung Kim <namhyung@gmail.com> wrote:
> > @flags can have O_CLOEXEC only so bitwise AND is not necessary.
> >
> > Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> > ---
> >  fs/eventpoll.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> > index 8cf07242067d..2e21fb85b8b6 100644
> > --- a/fs/eventpoll.c
> > +++ b/fs/eventpoll.c
> > @@ -1209,7 +1209,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
> >         * a file structure and a free file descriptor.
> >         */
> >        error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
> > -                                O_RDWR | (flags & O_CLOEXEC));
> > +                                O_RDWR | flags);
> 
> I'm strong against this.
> Whenever a new flag is allowed this will explode...

His point might be that there is a check right ahead, so flags can't be 
enything outside such mask.
But yeah, this is not worth creating another couple of objects in the GIT 
tree IMO.



- Davide


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-12 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 10:58 [PATCH] epoll: remove unnecessary bit operation in epoll_create1 syscall Namhyung Kim
2011-01-12 14:42 ` richard -rw- weinberger
2011-01-12 16:54   ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).