linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
@ 2024-01-10 15:47 wenyang.linux
  2024-01-11 10:43 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: wenyang.linux @ 2024-01-10 15:47 UTC (permalink / raw)
  To: Christian Brauner, Jens Axboe, Alexander Viro
  Cc: Wen Yang, Jan Kara, linux-fsdevel, linux-kernel

From: Wen Yang <wenyang.linux@foxmail.com>

introduce a BUILD_BUG_ON to check that the EFD_SEMAPHORE is equal to its
definition in the uapi file, just like EFD_CLOEXEC and EFD_NONBLOCK.

Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 fs/eventfd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/eventfd.c b/fs/eventfd.c
index 93848573c877..c1f5d71e7197 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -502,6 +502,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;
-- 
2.25.1


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

* Re: [PATCH] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
  2024-01-10 15:47 [PATCH] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi wenyang.linux
@ 2024-01-11 10:43 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2024-01-11 10:43 UTC (permalink / raw)
  To: wenyang.linux
  Cc: Christian Brauner, Jan Kara, linux-fsdevel, linux-kernel,
	Jens Axboe, Alexander Viro

On Wed, 10 Jan 2024 23:47:40 +0800, wenyang.linux@foxmail.com wrote:
> introduce a BUILD_BUG_ON to check that the EFD_SEMAPHORE is equal to its
> definition in the uapi file, just like EFD_CLOEXEC and EFD_NONBLOCK.
> 
> 

This isn't hugely useful tbh but it's not terrible either.

---

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
      https://git.kernel.org/vfs/vfs/c/c3d48db389b7

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

end of thread, other threads:[~2024-01-11 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 15:47 [PATCH] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi wenyang.linux
2024-01-11 10:43 ` Christian Brauner

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