Skip to content

Commit a3c10be

Browse files
Dan Carpenterhsiangkao
authored andcommitted
erofs: silence uninitialized variable warning in z_erofs_scan_folio()
Smatch complains that: fs/erofs/zdata.c:1047 z_erofs_scan_folio() error: uninitialized symbol 'err'. The issue is if we hit this (!(map->m_flags & EROFS_MAP_MAPPED)) { condition then "err" isn't set. It's inside a loop so we would have to hit that condition on every iteration. Initialize "err" to zero to solve this. Fixes: 5b9654e ("erofs: teach z_erofs_scan_folios() to handle multi-page folios") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent 1001042 commit a3c10be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/erofs/zdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ static int z_erofs_scan_folio(struct z_erofs_decompress_frontend *f,
962962
const unsigned int bs = i_blocksize(inode);
963963
unsigned int end = folio_size(folio), split = 0, cur, pgs;
964964
bool tight, excl;
965-
int err;
965+
int err = 0;
966966

967967
tight = (bs == PAGE_SIZE);
968968
z_erofs_onlinefolio_init(folio);

0 commit comments

Comments
 (0)