eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
Message ID | tencent_0BAA2DEAF9208D49987457E6583F9BE79507@qq.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-22466-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp882419dyi; Wed, 10 Jan 2024 07:58:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEw9yWc2mqdaaphtRUKVBN69JDnu+K2PXaJLVH0Zf1YzGr3sIu5JG3lXTVbClrGj9PQKW/+ X-Received: by 2002:a50:c18a:0:b0:557:efbe:8393 with SMTP id m10-20020a50c18a000000b00557efbe8393mr635237edf.48.1704902297024; Wed, 10 Jan 2024 07:58:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704902296; cv=none; d=google.com; s=arc-20160816; b=kk5TbG/yBOzfR9cLzFEzPuYZuiUKcKqqr+OKNkjlgoBh2QrVzHWHPlBo78iy25LYeA u8E0rdEk0UZIxx0+Mf2/MN9URbipudzy+0nB5x2juy02d1evaQkEUIOTOQp6p1cQ8NcK COVo3CLoyo1PkOsGT9vOS8GkLp9DtBbjhjgj/K/tg7kAtx5Dv79VBWjfysksMI0PPo8S LjSnEczFI1Ae83h7g0mI2LThO6skdiXSaong++plxL2zmfWCekIa0n0j9Ad9+2Un8+fg bTUxIoWabNJnVV8s9Ns9b+6xSrfADXheYz/vlT5s2tlxQEtdVLwM89TXHjJWZ5lGwa6m H0EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:subject:cc:to:from :message-id:dkim-signature; bh=wQOXJIJsJ7TK3AdRldjWOw0I/FRpUAQIImnC0W7okJk=; fh=SE5ptPTnPUWpctU59FORK/+bDimMZQ6sgOa772qwuao=; b=h2dX8eSFvirD78t63s31gVfP/ApfJAPl0D2oRLyRaUXIOh1rd+3ZV8BflX2plMNAlj ugasbWrBPTSyUfCAk0I/52fw+127ix951StZM4xQwVXb8rwB1SmWFOSQrHSsBsSocnW5 lUTwpc4NSNuCXZsjiMt8qlavySnBonDG76LqaTDth4gNC41oIsXcU0o+w5B1uZDRwgpl Tqgq3T3o/I/Thu8pRuZkwpUvCJee6wDlRnW4/0h+/3fwQaMxKavTNd9ZAxxly6P6YgJ0 2+pUnxEJt3VJ6kIkKCDFM/2cmLUhbSAKCsn1qBZqY9clqt/wSdWQP3rykF9H5MA0K/iL w4Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=LFL9ceFd; spf=pass (google.com: domain of linux-kernel+bounces-22466-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22466-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t12-20020a056402524c00b00554020a5d4fsi1899491edd.392.2024.01.10.07.58.16 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 07:58:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22466-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=LFL9ceFd; spf=pass (google.com: domain of linux-kernel+bounces-22466-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22466-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9DF4D1F2871F for <ouuuleilei@gmail.com>; Wed, 10 Jan 2024 15:57:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2064A4D10E; Wed, 10 Jan 2024 15:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="LFL9ceFd" Received: from out203-205-221-245.mail.qq.com (out203-205-221-245.mail.qq.com [203.205.221.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7C3E4C608; Wed, 10 Jan 2024 15:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1704902183; bh=wQOXJIJsJ7TK3AdRldjWOw0I/FRpUAQIImnC0W7okJk=; h=From:To:Cc:Subject:Date; b=LFL9ceFdkgvzsuoC9RKNS4/j9v+H8n9ohcAoCU5J+LRtzUr/l18WqmDCAodMQ0F0y X/aDu9XUxQzy9HK4XNERxNei2AI6/DpPFaMTj4ajETiLk6UESfEnY6LA8q3Eaed6/8 9A5v0IqrnC3pWATXdmr6j0j0kPgtVvrWoCLz5tIc= Received: from localhost.localdomain ([2409:8a60:2a63:2f30:ff74:6daa:56dc:111e]) by newxmesmtplogicsvrszc5-1.qq.com (NewEsmtp) with SMTP id BF136234; Wed, 10 Jan 2024 23:47:49 +0800 X-QQ-mid: xmsmtpt1704901669t7kbz5a5d Message-ID: <tencent_0BAA2DEAF9208D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Tcxc0 qa06QDSw== X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: wenyang.linux@foxmail.com To: Christian Brauner <brauner@kernel.org>, Jens Axboe <axboe@kernel.dk>, Alexander Viro <viro@zeniv.linux.org.uk> Cc: Wen Yang <wenyang.linux@foxmail.com>, Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi Date: Wed, 10 Jan 2024 23:47:40 +0800 X-OQ-MSGID: <20240110154740.41888-1-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787719630907559905 X-GMAIL-MSGID: 1787719630907559905 |
Series |
eventfd: add a BUILD_BUG_ON() to ensure consistency between EFD_SEMAPHORE and the uapi
|
|
Commit Message
Wen Yang
Jan. 10, 2024, 3:47 p.m. UTC
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(+)
Comments
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
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;