]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: silence an uninitialized variable warning
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 30 Oct 2020 11:46:20 +0000 (14:46 +0300)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 7 Nov 2020 03:52:36 +0000 (22:52 -0500)
commitb3dd49b284ff3cac470bce6a626a79e7af57c98d
treeef0435d55fef1f399dabd3e54ff1b8ccacea13e2
parent05346c2816f4c3bfd11cbe51877c73487c16c3e2
ext4: silence an uninitialized variable warning

Smatch complains that "i" can be uninitialized if we don't enter the
loop.  I don't know if it's possible but we may as well silence this
warning.

[ Initialize i to sb->s_blocksize instead of 0.  The only way the for
  loop could be skipped entirely is the in-memory data structures, in
  particular the bh->b_data for the on-disk superblock has gotten
  corrupted enough that calculated value of group is >= to
  ext4_get_groups_count(sb).  In that case, we want to exit
  immediately without allocating a block.  -- TYT ]

Fixes: 637a623587b9 ("ext4: fast commit recovery path")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201030114620.GB3251003@mwanda
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
fs/ext4/mballoc.c