[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_0BAA2DEAF9208D49987457E6583F9BE79507@qq.com>
Date: Wed, 10 Jan 2024 23:47:40 +0800
From: wenyang.linux@...mail.com
To: Christian Brauner <brauner@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Alexander Viro <viro@...iv.linux.org.uk>
Cc: Wen Yang <wenyang.linux@...mail.com>,
Jan Kara <jack@...e.cz>,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
From: Wen Yang <wenyang.linux@...mail.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@...mail.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Jan Kara <jack@...e.cz>
Cc: linux-fsdevel@...r.kernel.org
Cc: linux-kernel@...r.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
Powered by blists - more mailing lists