Re: [PATCH] nfs: remove dead code for the old swap over NFS implementation

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

 



Hi Christoph,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christoph-Hellwig/nfs-remove-dead-code-for-the-old-swap-over-NFS-implementation/20240615-161031
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
patch link:    https://lore.kernel.org/r/20240615080827.1239935-1-hch%40lst.de
patch subject: [PATCH] nfs: remove dead code for the old swap over NFS implementation
config: x86_64-randconfig-161-20240616 (https://download.01.org/0day-ci/archive/20240616/202406162226.EHq7u0eB-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

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>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202406162226.EHq7u0eB-lkp@xxxxxxxxx/

smatch warnings:
fs/nfs/write.c:737 nfs_inode_remove_request() warn: variable dereferenced before check 'folio' (see line 734)

vim +/folio +737 fs/nfs/write.c

^1da177e4c3f41 Linus Torvalds          2005-04-16  728  static void nfs_inode_remove_request(struct nfs_page *req)
^1da177e4c3f41 Linus Torvalds          2005-04-16  729  {
6a6d4644ce935d Scott Mayhew            2023-10-11  730  	struct nfs_inode *nfsi = NFS_I(nfs_page_to_inode(req));
6a6d4644ce935d Scott Mayhew            2023-10-11  731  
20633f042fd090 Weston Andros Adamson   2014-05-15  732  	if (nfs_page_group_sync_on_bit(req, PG_REMOVE)) {
0c493b5cf16e28 Trond Myklebust         2023-01-19  733  		struct folio *folio = nfs_page_to_folio(req->wb_head);
a43a94f57a0e00 Christoph Hellwig       2024-06-15 @734  		struct address_space *mapping = folio->mapping;
                                                                                                        ^^^^^^^^^^^^^^
Dereference

^1da177e4c3f41 Linus Torvalds          2005-04-16  735  
600f111ef51dc2 Matthew Wilcox (Oracle  2023-11-17  736) 		spin_lock(&mapping->i_private_lock);
a43a94f57a0e00 Christoph Hellwig       2024-06-15 @737  		if (likely(folio)) {
                                                                                   ^^^^^
Checked too late

0c493b5cf16e28 Trond Myklebust         2023-01-19  738  			folio->private = NULL;
0c493b5cf16e28 Trond Myklebust         2023-01-19  739  			folio_clear_private(folio);
0c493b5cf16e28 Trond Myklebust         2023-01-19  740  			clear_bit(PG_MAPPED, &req->wb_head->wb_flags);
29418aa4bd487c Mel Gorman              2012-07-31  741  		}
600f111ef51dc2 Matthew Wilcox (Oracle  2023-11-17  742) 		spin_unlock(&mapping->i_private_lock);
20633f042fd090 Weston Andros Adamson   2014-05-15  743  	}
17089a29a25a3b Weston Andros Adamson   2014-07-11  744  
33ea5aaa87cdae ZhangXiaoxu             2019-09-26  745  	if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) {
6a6d4644ce935d Scott Mayhew            2023-10-11  746  		atomic_long_dec(&nfsi->nrequests);
dd1b2026323a2d Jeff Layton             2023-09-19  747  		nfs_release_request(req);
33ea5aaa87cdae ZhangXiaoxu             2019-09-26  748  	}
^1da177e4c3f41 Linus Torvalds          2005-04-16  749  }

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





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux