Merge tag 'zonefs-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
[sfrench/cifs-2.6.git] / fs / eventfd.c
index ad8186d47ba76062f1540835c9a5a0a64f560cd5..9afdb722fa9257f4f0dfac12146a229933c11441 100644 (file)
@@ -251,7 +251,7 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
        ssize_t res;
        __u64 ucnt;
 
-       if (count < sizeof(ucnt))
+       if (count != sizeof(ucnt))
                return -EINVAL;
        if (copy_from_user(&ucnt, buf, sizeof(ucnt)))
                return -EFAULT;
@@ -283,13 +283,18 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
 static void eventfd_show_fdinfo(struct seq_file *m, struct file *f)
 {
        struct eventfd_ctx *ctx = f->private_data;
+       __u64 cnt;
 
        spin_lock_irq(&ctx->wqh.lock);
-       seq_printf(m, "eventfd-count: %16llx\n",
-                  (unsigned long long)ctx->count);
+       cnt = ctx->count;
        spin_unlock_irq(&ctx->wqh.lock);
-       seq_printf(m, "eventfd-id: %d\n", ctx->id);
-       seq_printf(m, "eventfd-semaphore: %d\n",
+
+       seq_printf(m,
+                  "eventfd-count: %16llx\n"
+                  "eventfd-id: %d\n"
+                  "eventfd-semaphore: %d\n",
+                  cnt,
+                  ctx->id,
                   !!(ctx->flags & EFD_SEMAPHORE));
 }
 #endif
@@ -383,6 +388,7 @@ static int do_eventfd(unsigned int count, int flags)
        /* Check the EFD_* constants for consistency.  */
        BUILD_BUG_ON(EFD_CLOEXEC != O_CLOEXEC);
        BUILD_BUG_ON(EFD_NONBLOCK != O_NONBLOCK);
+       BUILD_BUG_ON(EFD_SEMAPHORE != (1 << 0));
 
        if (flags & ~EFD_FLAGS_SET)
                return -EINVAL;