Commit 9e935407 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Namjae Jeon
Browse files

ntfs: Use return instead of goto in ntfs_mapping_pairs_decompress()



Clang warns (or errors with CONFIG_WERROR=y / W=e):

  fs/ntfs/runlist.c:755:6: error: variable 'rl' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    755 |         if (overflows_type(lowest_vcn, vcn)) {
        |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ...
  fs/ntfs/runlist.c:971:9: note: uninitialized use occurs here
    971 |         kvfree(rl);
        |                ^~
  ...

rl has not been allocated at this point so the 'goto err_out' should
really just be a return of the error pointer -EIO.

Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarHyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent 4ebcf3f9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -754,7 +754,7 @@ struct runlist_element *ntfs_mapping_pairs_decompress(const struct ntfs_volume *
	/* Validate lowest_vcn from on-disk metadata to ensure it is sane. */
	if (overflows_type(lowest_vcn, vcn)) {
		ntfs_error(vol->sb, "Invalid lowest_vcn in mapping pairs.");
		goto err_out;
		return ERR_PTR(-EIO);
	}
	/* Start at vcn = lowest_vcn and lcn 0. */
	vcn = lowest_vcn;