Re: [PATCH] ext4: silence an uninitialized variable warning

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

 



On Fri, Oct 30, 2020 at 02:46:20PM +0300, Dan Carpenter wrote:
> 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.

Thanks, applied.

I changed the patch so that i gets initialized to sb->s_blocksize
instead of 0.  The only way the for loop could be skipped entirely,
leaving i initialized, is if 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, and if i is left to sb->s_blocksize, that
will cause the function to bail out right after the skipped for loop.

     	       		   	    - Ted



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux