From: Dan Carpenter Date: Sat, 13 Jul 2024 01:04:16 +0000 (-0500) Subject: erofs: silence uninitialized variable warning in z_erofs_scan_folio() X-Git-Tag: v6.11-rc1~160^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3c10bed330b7ab401254a0c91098a03b04f1448;p=thirdparty%2Fkernel%2Flinux.git 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: 5b9654efb604 ("erofs: teach z_erofs_scan_folios() to handle multi-page folios") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/f78ab50e-ed6d-4275-8dd4-a4159fa565a2@stanley.mountain Signed-off-by: Gao Xiang --- diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 544fa0f922b43..424f656cd765e 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -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);