ntfs: fix uninitialized variable in ntfs_map_runlist_nolock

Smatch reported that ctx_needs_reset could be used uninitialized if
ntfs_map_runlist_nolock() fails early when a search context is provided.
Specifically, if the function returns -EIO because the attribute is
resident, the code jumps to err_out. This initializes ctx_needs_reset to
false to satisfy the static checker.

Reported-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Namjae Jeon 2026-04-11 00:18:30 +09:00
parent 32ba4750df
commit dacc18029e

View File

@ -92,7 +92,7 @@ int ntfs_map_runlist_nolock(struct ntfs_inode *ni, s64 vcn, struct ntfs_attr_sea
struct runlist_element *rl;
struct folio *put_this_folio = NULL;
int err = 0;
bool ctx_is_temporary = false, ctx_needs_reset;
bool ctx_is_temporary = false, ctx_needs_reset = false;
struct ntfs_attr_search_ctx old_ctx = { NULL, };
size_t new_rl_count;