[dm-devel] [dm:branches/for-4.15/dm 26/27] drivers//md/dm-table.c:1775:8: warning: 'i' may be used uninitialized in this function

kbuild test robot fengguang.wu at intel.com
Tue Nov 14 22:10:09 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: x86_64-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=x86_64 

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 >>):

   drivers//md/dm-table.c: In function 'dm_table_set_restrictions':
>> drivers//md/dm-table.c:1775:8: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
      ti = dm_table_get_target(t, i++);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers//md/dm-table.c:1772:11: note: 'i' was declared here
     unsigned i;
              ^

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

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

---
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: 26180 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20171115/e8269f0a/attachment.gz>


More information about the dm-devel mailing list