Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/ntfs3: avoid calling run_get_entry() when run == NULL in ntfs_read_run_nb_ra()

When ntfs_read_run_nb_ra() is invoked with run == NULL the code later
assumes run is valid and may call run_get_entry(NULL, ...), and also
uses clen/idx without initializing them. Smatch reported uninitialized
variable warnings and this can lead to undefined behaviour. This patch
fixes it.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202512230646.v5hrYXL0-lkp@intel.com/
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

+6
+6
fs/ntfs3/fsntfs.c
··· 1256 1256 1257 1257 } while (len32); 1258 1258 1259 + if (!run) { 1260 + err = -EINVAL; 1261 + goto out; 1262 + } 1263 + 1264 + /* Get next fragment to read. */ 1259 1265 vcn_next = vcn + clen; 1260 1266 if (!run_get_entry(run, ++idx, &vcn, &lcn, &clen) || 1261 1267 vcn != vcn_next) {