From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH] vfs: O_* bit numbers uniqueness check fix Date: Fri, 12 Mar 2010 23:15:49 +0800 Message-ID: <20100312151549.GA9174@localhost> References: <201003112211.o2BMBLfm013822@imap1.linux-foundation.org> <1268349064.3768.3.camel@localhost> <20100312134116.GA6502@localhost> <1268406087.3768.4.camel@localhost> <20100312151429.GA8519@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "akpm@linux-foundation.org" , "viro@zeniv.linux.org.uk" , "linux-fsdevel@vger.kernel.org" , "davem@davemloft.net" , "hch@infradead.org" , "jamie@shareable.org" , "rdreier@cisco.com" , "schwab@linux-m68k.org" , "sfr@canb.auug.org.au" To: Eric Paris Return-path: Received: from mga09.intel.com ([134.134.136.24]:34542 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934020Ab0CLPP6 (ORCPT ); Fri, 12 Mar 2010 10:15:58 -0500 Content-Disposition: inline In-Reply-To: <20100312151429.GA8519@localhost> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > > I think we need to update the hweight as well, otherwise I sure hope > > this would panic.... > > Ah faint.. Here is the fixed one. And the second one. --- Subject: vfs: O_* bit numbers uniqueness check fix 2 From: Wu Fengguang Date: Fri Mar 12 21:39:10 CST 2010 Follow the comment by Andreas: It's non-obvious why there are 18 flags listed here, but the hweight is only 17? Presumably this is because O_RDONLY has value 0, but that should at least be listed in a comment, or the test could be written more explicitly, like: BUILD_BUG_ON(18 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( CC: Andreas Dilger Signed-off-by: Wu Fengguang --- fs/fcntl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-mm.orig/fs/fcntl.c 2010-03-12 23:11:46.000000000 +0800 +++ linux-mm/fs/fcntl.c 2010-03-12 23:12:05.000000000 +0800 @@ -742,7 +742,7 @@ EXPORT_SYMBOL(kill_fasync); static int __init fcntl_init(void) { /* please add new bits here to ensure allocation uniqueness */ - BUILD_BUG_ON(18 != HWEIGHT32( + BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | O_APPEND | O_NONBLOCK |