[hch-xfs:xfs-crc 22/57] fs/iomap/ioend.c:370:6-25: WARNING: atomic_dec_and_test variation before object free at line 374.

kernel test robot <[email protected]> Wed, 22 Jul 2026 23:32:56 +0800
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   git://git.infradead.org/users/hch/xfs xfs-crc
head:   b119b814b2ff02941ccebfaddf61a22af4ebc521
commit: 95385d758fbe8e650aec920bd9633248688f5a69 [22/57] iomap: add support for data checksumming
config: x86_64-randconfig-104-20260722 (https://download.01.org/0day-ci/archive/20260722/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> fs/iomap/ioend.c:370:6-25: WARNING: atomic_dec_and_test variation before object free at line 374.

vim +370 fs/iomap/ioend.c

8f02cecd80b993 Christoph Hellwig 2025-07-10  357  
63b66913d11c5f Christoph Hellwig 2025-02-06  358  static u32 iomap_finish_ioend(struct iomap_ioend *ioend, int error)
63b66913d11c5f Christoph Hellwig 2025-02-06  359  {
95385d758fbe8e Christoph Hellwig 2026-07-19  360  	if (ioend->io_flags & IOMAP_IOEND_CHAINED) {
63b66913d11c5f Christoph Hellwig 2025-02-06  361  		struct bio *bio = &ioend->io_bio;
63b66913d11c5f Christoph Hellwig 2025-02-06  362  
63b66913d11c5f Christoph Hellwig 2025-02-06  363  		ioend = ioend->io_parent;
63b66913d11c5f Christoph Hellwig 2025-02-06  364  		bio_put(bio);
63b66913d11c5f Christoph Hellwig 2025-02-06  365  	}
63b66913d11c5f Christoph Hellwig 2025-02-06  366  
63b66913d11c5f Christoph Hellwig 2025-02-06  367  	if (error)
63b66913d11c5f Christoph Hellwig 2025-02-06  368  		cmpxchg(&ioend->io_error, 0, error);
63b66913d11c5f Christoph Hellwig 2025-02-06  369  
63b66913d11c5f Christoph Hellwig 2025-02-06 @370  	if (!atomic_dec_and_test(&ioend->io_remaining))
63b66913d11c5f Christoph Hellwig 2025-02-06  371  		return 0;
0b10a370529cbd Christoph Hellwig 2026-02-23  372  
95385d758fbe8e Christoph Hellwig 2026-07-19  373  	if (iomap_has_csum(ioend))
95385d758fbe8e Christoph Hellwig 2026-07-19 @374  		iomap_csum_free(ioend);
95385d758fbe8e Christoph Hellwig 2026-07-19  375  
e523f2d4c974a8 Christoph Hellwig 2025-02-06  376  	if (ioend->io_flags & IOMAP_IOEND_DIRECT)
e523f2d4c974a8 Christoph Hellwig 2025-02-06  377  		return iomap_finish_ioend_direct(ioend);
e8f9cf03c9dc94 Christoph Hellwig 2026-02-23  378  	if (bio_op(&ioend->io_bio) == REQ_OP_READ)
e8f9cf03c9dc94 Christoph Hellwig 2026-02-23  379  		return iomap_finish_ioend_buffered_read(ioend);
e8f9cf03c9dc94 Christoph Hellwig 2026-02-23  380  	return iomap_finish_ioend_buffered_write(ioend);
63b66913d11c5f Christoph Hellwig 2025-02-06  381  }
63b66913d11c5f Christoph Hellwig 2025-02-06  382  

:::::: The code at line 370 was first introduced by commit
:::::: 63b66913d11c5f3572dfdee38e78d510d0f90aa8 iomap: move common ioend code to ioend.c

:::::: TO: Christoph Hellwig <[email protected]>
:::::: CC: Christian Brauner <[email protected]>

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