[ceph-client:testing 16/16] fs//ceph/addr.c:1522:9: warning: 'ret' may be used uninitialized in this function

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

 



tree:   https://github.com/ceph/ceph-client.git testing
head:   cd9b44d9ab362425bf8e4b83cb94a90e3b43cf53
commit: cd9b44d9ab362425bf8e4b83cb94a90e3b43cf53 [16/16] fs: ceph: Adding new return type vm_fault_t
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout cd9b44d9ab362425bf8e4b83cb94a90e3b43cf53
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   fs//ceph/addr.c: In function 'ceph_filemap_fault':
>> fs//ceph/addr.c:1522:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return ret;
            ^~~

vim +/ret +1522 fs//ceph/addr.c

1d3576fd1 Sage Weil          2009-10-06  1430  
1d3576fd1 Sage Weil          2009-10-06  1431  /*
1d3576fd1 Sage Weil          2009-10-06  1432   * vm ops
1d3576fd1 Sage Weil          2009-10-06  1433   */
cd9b44d9a Souptick Joarder   2018-07-22  1434  static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)
61f688162 Yan, Zheng         2013-11-28  1435  {
11bac8000 Dave Jiang         2017-02-24  1436  	struct vm_area_struct *vma = vmf->vma;
61f688162 Yan, Zheng         2013-11-28  1437  	struct inode *inode = file_inode(vma->vm_file);
61f688162 Yan, Zheng         2013-11-28  1438  	struct ceph_inode_info *ci = ceph_inode(inode);
61f688162 Yan, Zheng         2013-11-28  1439  	struct ceph_file_info *fi = vma->vm_file->private_data;
3738daa68 Yan, Zheng         2014-11-14  1440  	struct page *pinned_page = NULL;
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1441  	loff_t off = vmf->pgoff << PAGE_SHIFT;
cd9b44d9a Souptick Joarder   2018-07-22  1442  	int want, got, err;
4f7e89f6a Yan, Zheng         2016-05-10  1443  	sigset_t oldset;
cd9b44d9a Souptick Joarder   2018-07-22  1444  	vm_fault_t ret;
4f7e89f6a Yan, Zheng         2016-05-10  1445  
4f7e89f6a Yan, Zheng         2016-05-10  1446  	ceph_block_sigs(&oldset);
61f688162 Yan, Zheng         2013-11-28  1447  
61f688162 Yan, Zheng         2013-11-28  1448  	dout("filemap_fault %p %llx.%llx %llu~%zd trying to get caps\n",
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1449  	     inode, ceph_vinop(inode), off, (size_t)PAGE_SIZE);
61f688162 Yan, Zheng         2013-11-28  1450  	if (fi->fmode & CEPH_FILE_MODE_LAZY)
61f688162 Yan, Zheng         2013-11-28  1451  		want = CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO;
61f688162 Yan, Zheng         2013-11-28  1452  	else
61f688162 Yan, Zheng         2013-11-28  1453  		want = CEPH_CAP_FILE_CACHE;
4f7e89f6a Yan, Zheng         2016-05-10  1454  
61f688162 Yan, Zheng         2013-11-28  1455  	got = 0;
cd9b44d9a Souptick Joarder   2018-07-22  1456  	err = ceph_get_caps(ci, CEPH_CAP_FILE_RD, want, -1, &got, &pinned_page);
cd9b44d9a Souptick Joarder   2018-07-22  1457  	if (err < 0)
4f7e89f6a Yan, Zheng         2016-05-10  1458  		goto out_restore;
6ce026e41 Yan, Zheng         2016-05-10  1459  
61f688162 Yan, Zheng         2013-11-28  1460  	dout("filemap_fault %p %llu~%zd got cap refs on %s\n",
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1461  	     inode, off, (size_t)PAGE_SIZE, ceph_cap_string(got));
61f688162 Yan, Zheng         2013-11-28  1462  
83701246a Yan, Zheng         2014-11-14  1463  	if ((got & (CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO)) ||
2b1ac852e Yan, Zheng         2016-10-25  1464  	    ci->i_inline_version == CEPH_INLINE_NONE) {
5d9883082 Yan, Zheng         2017-12-15  1465  		CEPH_DEFINE_RW_CONTEXT(rw_ctx, got);
5d9883082 Yan, Zheng         2017-12-15  1466  		ceph_add_rw_context(fi, &rw_ctx);
11bac8000 Dave Jiang         2017-02-24  1467  		ret = filemap_fault(vmf);
5d9883082 Yan, Zheng         2017-12-15  1468  		ceph_del_rw_context(fi, &rw_ctx);
cd9b44d9a Souptick Joarder   2018-07-22  1469  		dout("filemap_fault %p %llu~%zd drop cap refs %s ret %x\n",
cd9b44d9a Souptick Joarder   2018-07-22  1470  			inode, off, (size_t)PAGE_SIZE,
cd9b44d9a Souptick Joarder   2018-07-22  1471  				ceph_cap_string(got), ret);
2b1ac852e Yan, Zheng         2016-10-25  1472  	} else
cd9b44d9a Souptick Joarder   2018-07-22  1473  		err = -EAGAIN;
61f688162 Yan, Zheng         2013-11-28  1474  
3738daa68 Yan, Zheng         2014-11-14  1475  	if (pinned_page)
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1476  		put_page(pinned_page);
61f688162 Yan, Zheng         2013-11-28  1477  	ceph_put_cap_refs(ci, got);
61f688162 Yan, Zheng         2013-11-28  1478  
cd9b44d9a Souptick Joarder   2018-07-22  1479  	if (err != -EAGAIN)
4f7e89f6a Yan, Zheng         2016-05-10  1480  		goto out_restore;
83701246a Yan, Zheng         2014-11-14  1481  
83701246a Yan, Zheng         2014-11-14  1482  	/* read inline data */
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1483  	if (off >= PAGE_SIZE) {
83701246a Yan, Zheng         2014-11-14  1484  		/* does not support inline data > PAGE_SIZE */
83701246a Yan, Zheng         2014-11-14  1485  		ret = VM_FAULT_SIGBUS;
83701246a Yan, Zheng         2014-11-14  1486  	} else {
83701246a Yan, Zheng         2014-11-14  1487  		struct address_space *mapping = inode->i_mapping;
83701246a Yan, Zheng         2014-11-14  1488  		struct page *page = find_or_create_page(mapping, 0,
c62d25556 Michal Hocko       2015-11-06  1489  						mapping_gfp_constraint(mapping,
c62d25556 Michal Hocko       2015-11-06  1490  						~__GFP_FS));
83701246a Yan, Zheng         2014-11-14  1491  		if (!page) {
83701246a Yan, Zheng         2014-11-14  1492  			ret = VM_FAULT_OOM;
4f7e89f6a Yan, Zheng         2016-05-10  1493  			goto out_inline;
83701246a Yan, Zheng         2014-11-14  1494  		}
cd9b44d9a Souptick Joarder   2018-07-22  1495  		err = __ceph_do_getattr(inode, page,
83701246a Yan, Zheng         2014-11-14  1496  					 CEPH_STAT_CAP_INLINE_DATA, true);
cd9b44d9a Souptick Joarder   2018-07-22  1497  		if (err < 0 || off >= i_size_read(inode)) {
83701246a Yan, Zheng         2014-11-14  1498  			unlock_page(page);
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1499  			put_page(page);
cd9b44d9a Souptick Joarder   2018-07-22  1500  			if (err == -ENOMEM)
cd9b44d9a Souptick Joarder   2018-07-22  1501  				ret = VM_FAULT_OOM;
6ce026e41 Yan, Zheng         2016-05-10  1502  			else
83701246a Yan, Zheng         2014-11-14  1503  				ret = VM_FAULT_SIGBUS;
4f7e89f6a Yan, Zheng         2016-05-10  1504  			goto out_inline;
83701246a Yan, Zheng         2014-11-14  1505  		}
cd9b44d9a Souptick Joarder   2018-07-22  1506  		if (err < PAGE_SIZE)
cd9b44d9a Souptick Joarder   2018-07-22  1507  			zero_user_segment(page, err, PAGE_SIZE);
83701246a Yan, Zheng         2014-11-14  1508  		else
83701246a Yan, Zheng         2014-11-14  1509  			flush_dcache_page(page);
83701246a Yan, Zheng         2014-11-14  1510  		SetPageUptodate(page);
83701246a Yan, Zheng         2014-11-14  1511  		vmf->page = page;
83701246a Yan, Zheng         2014-11-14  1512  		ret = VM_FAULT_MAJOR | VM_FAULT_LOCKED;
4f7e89f6a Yan, Zheng         2016-05-10  1513  out_inline:
cd9b44d9a Souptick Joarder   2018-07-22  1514  		dout("filemap_fault %p %llu~%zd read inline data ret %x\n",
09cbfeaf1 Kirill A. Shutemov 2016-04-01  1515  		     inode, off, (size_t)PAGE_SIZE, ret);
4f7e89f6a Yan, Zheng         2016-05-10  1516  	}
4f7e89f6a Yan, Zheng         2016-05-10  1517  out_restore:
4f7e89f6a Yan, Zheng         2016-05-10  1518  	ceph_restore_sigs(&oldset);
cd9b44d9a Souptick Joarder   2018-07-22  1519  	if (err < 0)
cd9b44d9a Souptick Joarder   2018-07-22  1520  		ret = vmf_error(err);
6ce026e41 Yan, Zheng         2016-05-10  1521  
61f688162 Yan, Zheng         2013-11-28 @1522  	return ret;
61f688162 Yan, Zheng         2013-11-28  1523  }
1d3576fd1 Sage Weil          2009-10-06  1524  

:::::: The code at line 1522 was first introduced by commit
:::::: 61f68816211ee4b884dc0dda8dd4d977548f4865 ceph: check caps in filemap_fault and page_mkwrite

:::::: TO: Yan, Zheng <zheng.z.yan@xxxxxxxxx>
:::::: CC: Ilya Dryomov <ilya.dryomov@xxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux