[dm-devel] [dm:branches/for-4.15/dm 26/27] drivers/md/dm-table.c:1772:11: warning: 'i' is used uninitialized in this function

kbuild test robot fengguang.wu at intel.com
Tue Nov 14 22:21:11 UTC 2017


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git branches/for-4.15/dm
head:   6a768a2a8fd04fa89cfad1385d15601ff22adaff
commit: 21846377c4fd5d3ccfcf0dc68f0a4866c0c49803 [26/27] dm: discard support requires all targets in a table support discards
config: i386-randconfig-x001-201746 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        git checkout 21846377c4fd5d3ccfcf0dc68f0a4866c0c49803
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/md/dm-table.c: In function 'dm_table_set_restrictions':
>> drivers/md/dm-table.c:1772:11: warning: 'i' is used uninitialized in this function [-Wuninitialized]
     unsigned i;
              ^

vim +/i +1772 drivers/md/dm-table.c

a7ffb6a5 Mikulas Patocka 2014-07-10  1768  
a7ffb6a5 Mikulas Patocka 2014-07-10  1769  static bool dm_table_supports_discards(struct dm_table *t)
a7ffb6a5 Mikulas Patocka 2014-07-10  1770  {
a7ffb6a5 Mikulas Patocka 2014-07-10  1771  	struct dm_target *ti;
3c120169 Mikulas Patocka 2017-04-18 @1772  	unsigned i;
a7ffb6a5 Mikulas Patocka 2014-07-10  1773  
21846377 Mike Snitzer    2017-11-14  1774  	while (i < dm_table_get_num_targets(t)) {
21846377 Mike Snitzer    2017-11-14  1775  		ti = dm_table_get_target(t, i++);
a7ffb6a5 Mikulas Patocka 2014-07-10  1776  
a7ffb6a5 Mikulas Patocka 2014-07-10  1777  		if (!ti->num_discard_bios)
21846377 Mike Snitzer    2017-11-14  1778  			return false;
a7ffb6a5 Mikulas Patocka 2014-07-10  1779  
21846377 Mike Snitzer    2017-11-14  1780  		/*
21846377 Mike Snitzer    2017-11-14  1781  		 * Either the target provides discard support (as implied by setting
21846377 Mike Snitzer    2017-11-14  1782  		 * 'discards_supported') or it relies on _all_ data devices having
21846377 Mike Snitzer    2017-11-14  1783  		 * discard support.
21846377 Mike Snitzer    2017-11-14  1784  		 */
21846377 Mike Snitzer    2017-11-14  1785  		if (!ti->discards_supported &&
21846377 Mike Snitzer    2017-11-14  1786  		    (!ti->type->iterate_devices ||
21846377 Mike Snitzer    2017-11-14  1787  		     ti->type->iterate_devices(ti, device_not_discard_capable, NULL)))
21846377 Mike Snitzer    2017-11-14  1788  			return false;
a7ffb6a5 Mikulas Patocka 2014-07-10  1789  	}
a7ffb6a5 Mikulas Patocka 2014-07-10  1790  
21846377 Mike Snitzer    2017-11-14  1791  	return true;
a7ffb6a5 Mikulas Patocka 2014-07-10  1792  }
a7ffb6a5 Mikulas Patocka 2014-07-10  1793  

:::::: The code at line 1772 was first introduced by commit
:::::: 3c12016910061c2a19d985fba7f7dec19d6a3a09 dm table: replace while loops with for loops

:::::: TO: Mikulas Patocka <mpatocka at redhat.com>
:::::: CC: Mike Snitzer <snitzer at redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 28635 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20171115/2e0013b9/attachment.gz>


More information about the dm-devel mailing list