]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ntfs: fix invalid PTR_ERR() usage in __ntfs_bitmap_set_bits_in_run()
authorNamjae Jeon <linkinjeon@kernel.org>
Tue, 28 Apr 2026 12:59:30 +0000 (21:59 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Tue, 28 Apr 2026 12:59:59 +0000 (21:59 +0900)
commitd986ba0329dcca102e227995371135c9bbcefb6b
treee2dba117a8ec710cf78692dddf1953a84caeff70
parent785bc568161d96fdbd4326294d427a48e66fe60f
ntfs: fix invalid PTR_ERR() usage in __ntfs_bitmap_set_bits_in_run()

The Smatch reported a warning in __ntfs_bitmap_set_bits_in_run():
"warn: passing a valid pointer to 'PTR_ERR'"

This occurs because the 'folio' variable might contain a valid pointer
when jumping to the 'rollback' label, specifically when 'cnt <= 0' is
detected during the subsequent page mapping loop. In such cases,
calling PTR_ERR(folio) is incorrect as it does not contain an error
code.

Fix this by introducing an explicit 'err' variable to track the error
status. This ensures that the rollback logic and the return value
consistently use a proper error code regardless of the state of the
folio pointer.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/bitmap.c