From: Gao Xiang Date: Thu, 10 Mar 2022 17:34:48 +0000 (+0800) Subject: erofs: silence warnings related to impossible m_plen X-Git-Tag: v5.18-rc1~177^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d467e980d0239fd95cc93b0995199973624a4825;p=thirdparty%2Flinux.git 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 Reported-by: Dan Carpenter Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20220310173448.19962-1-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang --- diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 361b1d6e4bf9e..b4059b9c3bacf 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -494,7 +494,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m, !(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_1)) || ((m->headtype == Z_EROFS_VLE_CLUSTER_TYPE_HEAD2) && !(vi->z_advise & Z_EROFS_ADVISE_BIG_PCLUSTER_2))) { - map->m_plen = 1 << lclusterbits; + map->m_plen = 1ULL << lclusterbits; return 0; } lcn = m->lcn + 1; @@ -540,7 +540,7 @@ static int z_erofs_get_extent_compressedlen(struct z_erofs_maprecorder *m, return -EFSCORRUPTED; } out: - map->m_plen = m->compressedlcs << lclusterbits; + map->m_plen = (u64)m->compressedlcs << lclusterbits; return 0; err_bonus_cblkcnt: erofs_err(m->inode->i_sb,