fs/bcachefs/btree_cache.c:456:15: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Sun Nov 19 2023 - 16:51:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 037266a5f7239ead1530266f7d7af153d2a867fa
commit: 1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a bcachefs: Initial commit
date: 4 weeks ago
config: hexagon-randconfig-r121-20231119 (https://download.01.org/0day-ci/archive/20231120/202311200512.l1n53SlO-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20231120/202311200512.l1n53SlO-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311200512.l1n53SlO-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> fs/bcachefs/btree_cache.c:456:15: sparse: sparse: Using plain integer as NULL pointer
fs/bcachefs/btree_cache.c:468:15: sparse: sparse: Using plain integer as NULL pointer
fs/bcachefs/btree_cache.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/xarray.h, ...):
include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false
fs/bcachefs/btree_cache.c: note: in included file (through include/linux/backing-dev-defs.h, fs/bcachefs/bcachefs.h):
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true

vim +456 fs/bcachefs/btree_cache.c

450
451 int bch2_btree_cache_cannibalize_lock(struct bch_fs *c, struct closure *cl)
452 {
453 struct btree_cache *bc = &c->btree_cache;
454 struct task_struct *old;
455
> 456 old = cmpxchg(&bc->alloc_lock, NULL, current);
457 if (old == NULL || old == current)
458 goto success;
459
460 if (!cl) {
461 trace_btree_node_cannibalize_lock_fail(c);
462 return -ENOMEM;
463 }
464
465 closure_wait(&bc->alloc_wait, cl);
466
467 /* Try again, after adding ourselves to waitlist */
468 old = cmpxchg(&bc->alloc_lock, NULL, current);
469 if (old == NULL || old == current) {
470 /* We raced */
471 closure_wake_up(&bc->alloc_wait);
472 goto success;
473 }
474
475 trace_btree_node_cannibalize_lock_fail(c);
476 return -EAGAIN;
477
478 success:
479 trace_btree_node_cannibalize_lock(c);
480 return 0;
481 }
482

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki