Re: [PATCH] vfs: O_* bit numbers uniqueness check fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > 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 <fengguang.wu@xxxxxxxxx>
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 <adilger@xxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
 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	|
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux