lkml.org 
[lkml]   [2019]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: nfs: dir.c: Fix sparse error
Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[cannot apply to v5.5-rc1 next-20191210]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/madhuparnabhowmik04-gmail-com/fs-nfs-dir-c-Fix-sparse-error/20191210-173307
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: s390-debug_defconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

In file included from include/linux/rbtree.h:22:0,
from include/linux/mm_types.h:10,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:13,
from fs/nfs/dir.c:21:
fs/nfs/dir.c: In function 'nfs_access_get_cached_rcu':
>> fs/nfs/dir.c:2353:23: error: implicit declaration of function 'list_tail_rcu'; did you mean 'list_del_rcu'? [-Werror=implicit-function-declaration]
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^
include/linux/rcupdate.h:319:10: note: in definition of macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
>> fs/nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:319:9: error: invalid type argument of unary '*' (have 'int')
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
>> fs/nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
include/linux/rcupdate.h:319:35: error: invalid type argument of unary '*' (have 'int')
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
>> fs/nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:11:0,
from include/linux/list.h:9,
from include/linux/module.h:9,
from fs/nfs/dir.c:21:
include/linux/compiler.h:263:20: error: lvalue required as unary '&' operand
__read_once_size(&(x), __u.__c, sizeof(x)); \
^
include/linux/compiler.h:269:22: note: in expansion of macro '__READ_ONCE'
#define READ_ONCE(x) __READ_ONCE(x, 1)
^~~~~~~~~~~
>> include/linux/rcupdate.h:319:48: note: in expansion of macro 'READ_ONCE'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^~~~~~~~~
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
>> fs/nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
include/linux/compiler.h:265:28: error: lvalue required as unary '&' operand
__read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
^
include/linux/compiler.h:269:22: note: in expansion of macro '__READ_ONCE'
#define READ_ONCE(x) __READ_ONCE(x, 1)
^~~~~~~~~~~
>> include/linux/rcupdate.h:319:48: note: in expansion of macro 'READ_ONCE'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^~~~~~~~~
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
>> fs/nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
In file included from include/linux/rbtree.h:22:0,
from include/linux/mm_types.h:10,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:13,
from fs/nfs/dir.c:21:
include/linux/rcupdate.h:322:11: error: invalid type argument of unary '*' (have 'int')
((typeof(*p) __force __kernel *)(________p1)); \
^
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/rbtree.h:22:0,
from include/linux/mm_types.h:10,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:13,
from fs//nfs/dir.c:21:
fs//nfs/dir.c: In function 'nfs_access_get_cached_rcu':
fs//nfs/dir.c:2353:23: error: implicit declaration of function 'list_tail_rcu'; did you mean 'list_del_rcu'? [-Werror=implicit-function-declaration]
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^
include/linux/rcupdate.h:319:10: note: in definition of macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
fs//nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:319:9: error: invalid type argument of unary '*' (have 'int')
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
fs//nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
include/linux/rcupdate.h:319:35: error: invalid type argument of unary '*' (have 'int')
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
fs//nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:11:0,
from include/linux/list.h:9,
from include/linux/module.h:9,
from fs//nfs/dir.c:21:
include/linux/compiler.h:263:20: error: lvalue required as unary '&' operand
__read_once_size(&(x), __u.__c, sizeof(x)); \
^
include/linux/compiler.h:269:22: note: in expansion of macro '__READ_ONCE'
#define READ_ONCE(x) __READ_ONCE(x, 1)
^~~~~~~~~~~
>> include/linux/rcupdate.h:319:48: note: in expansion of macro 'READ_ONCE'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^~~~~~~~~
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
fs//nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
include/linux/compiler.h:265:28: error: lvalue required as unary '&' operand
__read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
^
include/linux/compiler.h:269:22: note: in expansion of macro '__READ_ONCE'
#define READ_ONCE(x) __READ_ONCE(x, 1)
^~~~~~~~~~~
>> include/linux/rcupdate.h:319:48: note: in expansion of macro 'READ_ONCE'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^~~~~~~~~
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
fs//nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
In file included from include/linux/rbtree.h:22:0,
from include/linux/mm_types.h:10,
from include/linux/mmzone.h:21,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:13,
from fs//nfs/dir.c:21:
include/linux/rcupdate.h:322:11: error: invalid type argument of unary '*' (have 'int')
((typeof(*p) __force __kernel *)(________p1)); \
^
>> include/linux/rcupdate.h:456:2: note: in expansion of macro '__rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/rcupdate.h:514:28: note: in expansion of macro 'rcu_dereference_check'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^~~~~~~~~~~~~~~~~~~~~
fs//nfs/dir.c:2353:7: note: in expansion of macro 'rcu_dereference'
lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +2353 fs/nfs/dir.c

2339
2340 static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res)
2341 {
2342 /* Only check the most recently returned cache entry,
2343 * but do it without locking.
2344 */
2345 struct nfs_inode *nfsi = NFS_I(inode);
2346 struct nfs_access_entry *cache;
2347 int err = -ECHILD;
2348 struct list_head *lh;
2349
2350 rcu_read_lock();
2351 if (nfsi->cache_validity & NFS_INO_INVALID_ACCESS)
2352 goto out;
> 2353 lh = rcu_dereference(list_tail_rcu(&nfsi->access_cache_entry_lru));
2354 cache = list_entry(lh, struct nfs_access_entry, lru);
2355 if (lh == &nfsi->access_cache_entry_lru ||
2356 cred != cache->cred)
2357 cache = NULL;
2358 if (cache == NULL)
2359 goto out;
2360 if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
2361 goto out;
2362 res->cred = cache->cred;
2363 res->mask = cache->mask;
2364 err = 0;
2365 out:
2366 rcu_read_unlock();
2367 return err;
2368 }
2369

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2019-12-11 02:02    [W:0.044 / U:1.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site