linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] eventfd: type bug in eventfd_poll()
@ 2015-01-19 19:33 Dan Carpenter
  2015-01-19 19:41 ` Chris Mason
  2015-01-29 18:56 ` Chris Mason
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-01-19 19:33 UTC (permalink / raw)
  To: Alexander Viro, Chris Mason, Andrew Morton; +Cc: linux-fsdevel, kernel-janitors

Since "count" is an unsigned int, then these conditions are never true:

        if (count == ULLONG_MAX)
                events |= POLLERR;
        if (ULLONG_MAX - 1 > count)
                events |= POLLOUT;

It should be a u64, because that's what ctx->count is.  Also GCC
complains that "flags" is unused.

Fixes: a90de8a54127 ('eventfd: don't take the spinlock in eventfd_poll')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/eventfd.c b/fs/eventfd.c
index 439e6f0..8d0c0df 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -118,8 +118,7 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait)
 {
 	struct eventfd_ctx *ctx = file->private_data;
 	unsigned int events = 0;
-	unsigned long flags;
-	unsigned int count;
+	u64 count;
 
 	poll_wait(file, &ctx->wqh, wait);
 	smp_rmb();

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

end of thread, other threads:[~2015-01-29 18:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-19 19:33 [patch -next] eventfd: type bug in eventfd_poll() Dan Carpenter
2015-01-19 19:41 ` Chris Mason
2015-01-29 18:56 ` Chris Mason

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).