aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWen Yang <[email protected]>2024-01-10 23:47:40 +0800
committerChristian Brauner <[email protected]>2024-01-22 15:33:36 +0100
commit6b6ec4ca4e33d797f887cb2d7ecf365b652b338c (patch)
treed8876c96f67d7bbeface8709d8af369fd9fe3eab
parent6c8ac6e24eb04d1eebc442029d7a7528e5461cb8 (diff)
eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Alexander Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Jan Kara <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
-rw-r--r--fs/eventfd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c
index ad8186d47ba7..0252b71099fb 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -383,6 +383,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;