Skip to content

Commit

Permalink
erofs: silence uninitialized variable warning in z_erofs_scan_folio()
Browse files Browse the repository at this point in the history
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 <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/f78ab50e-ed6d-4275-8dd4-a4159fa565a2@stanley.mountain
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
  • Loading branch information
Dan Carpenter authored and hsiangkao committed Jul 13, 2024
1 parent 1001042 commit a3c10be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/erofs/zdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ static int z_erofs_scan_folio(struct z_erofs_decompress_frontend *f,
const unsigned int bs = i_blocksize(inode);
unsigned int end = folio_size(folio), split = 0, cur, pgs;
bool tight, excl;
int err;
int err = 0;

tight = (bs == PAGE_SIZE);
z_erofs_onlinefolio_init(folio);
Expand Down

0 comments on commit a3c10be

Please sign in to comment.