I just tried to compile linux-3.6-rc4 with a recent snapshot of the gcc compiler. It said fs/nfs/inode.c:157:41: warning: argument to ‘sizeof’ in ‘memset’ call is the same pointer type ‘__be32 *’ as the destination; expected ‘__be32’ or an explicit length [-Wsizeof-pointer-memaccess] The source code is memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode))); maybe something like memset(NFS_COOKIEVERF(inode), 0, sizeof(__be32)); might be better.
That would be a gcc regression, not a kernel bug. NFS_COOKIEVERF(inode) points to the 'cookieverf' field in struct nfs_inode, which is an array. If the 'sizeof' operator suddenly thinks that it is a pointer, then that's a pretty major gcc bug... Marking this as resolved invalid.
>That would be a gcc regression, not a kernel bug. Can't see that, myself. The code looks to me like memset(X, 0, sizeof(X)); First parameter is memset is a pointer, so I wouldn't expect to see that first parameter duplicated as the third parameter. I would expect to see something like memset(X, 0, sizeof(*X)); or maybe memset(X, 0, SOME_NUMBER * sizeof(*X));
No... The problem is that NFS_COOKIEVERF got changed from being a macro to a static inline back in 2.6.25. That changed the type being passed to the memset() from being an array to being a pointer. At this point NFS_COOKIEVERF appears to be pure obfuscation and just needs to be removed altogether.
Created attachment 79151 [details] NFS: Fix the initialisation of the readdir 'cookieverf' array
A patch referencing this bug report has been merged in Linux v3.6-rc6: commit c3f52af3e03013db5237e339c817beaae5ec9e3a Author: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Mon Sep 3 14:56:02 2012 -0400 NFS: Fix the initialisation of the readdir 'cookieverf' array