Re: [PATCH 7/7] ext4: improve inode table blocks counting in ext4_num_overhead_clusters

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

 




on 3/20/2023 8:44 PM, Jan Kara wrote:
> On Tue 21-02-23 19:59:19, Kemeng Shi wrote:
>> As inode table blocks are contiguous, inode table blocks inside the
>> block_group can be represented as range [itbl_cluster_start,
>> itbl_cluster_last]. Then we can simply account inode table cluters and
>> check cluster overlap with [itbl_cluster_start, itbl_cluster_last] instead
>> of traverse each block of inode table.
>> By the way, this patch fixes code style problem of comment for
>> ext4_num_overhead_clusters.
>>
>> Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
> 
> FWIW this is triggering Coverity warning:
> 
> *** CID 1536792:  Uninitialized variables  (UNINIT)
> /fs/ext4/balloc.c: 153 in ext4_num_overhead_clusters()
> 147                     inode_cluster = EXT4_B2C(sbi,
> 148                                              ext4_inode_bitmap(sb, gdp) - st
> 149                     /*
> 150                      * Additional check if inode bitmap is in just accounted
> 151                      * block_cluster
> 152                      */
>>>>     CID 1536792:  Uninitialized variables  (UNINIT)
>>>>     Using uninitialized value "block_cluster".
> 153                     if (inode_cluster != block_cluster &&
> 154                         inode_cluster >= base_clusters &&
> 155                         (inode_cluster < itbl_cluster_start ||
> 156                         inode_cluster > itbl_cluster_end))
> 157                             num_clusters++;
> 158             }
> 
> which actually looks valid AFAICT.
Yes, there is a risk to access uninitialized block_cluster if block bitmap block
and inode bitmap block are in different groups. Patch to fix is just sent. Thanks!

-- 
Best wishes
Kemeng Shi




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux