Skip to content

Commit d467e98

Browse files
committed
erofs: silence warnings related to impossible m_plen
Dan reported two smatch warnings [1], .. warn: should '1 << lclusterbits' be a 64 bit type? .. warn: should 'm->compressedlcs << lclusterbits' be a 64 bit type? In practice, m_plen cannot be more than 1MiB due to on-disk constraint for the compression mode, so we're always safe here. In order to make static analyzers happy and not report again, let's silence them instead. [1] https://lore.kernel.org/r/202203091002.lJVzsX6e-lkp@intel.com Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Chao Yu <chao@kernel.org> Link: https://lore.kernel.org/r/20220310173448.19962-1-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent faac509 commit d467e98

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/erofs/zmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m,
494494
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1)) ||
495495
((m->headtype == Z_EROFS_VLE_CLUSTER_TYPE_HEAD2) &&
496496
!(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_2))) {
497-
map->m_plen = 1 << lclusterbits;
497+
map->m_plen = 1ULL << lclusterbits;
498498
return 0;
499499
}
500500
lcn = m->lcn + 1;
@@ -540,7 +540,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m,
540540
return -EFSCORRUPTED;
541541
}
542542
out:
543-
map->m_plen = m->compressedlcs << lclusterbits;
543+
map->m_plen = (u64)m->compressedlcs << lclusterbits;
544544
return 0;
545545
err_bonus_cblkcnt:
546546
erofs_err(m->inode->i_sb,

0 commit comments

Comments
 (0)