Commit c37d9e68 authored by Namjae Jeon's avatar Namjae Jeon
Browse files

ntfs: fix variable dereferenced before check ni in ntfs_attr_open()



Smatch warnings:
 ntfs_attr_open() warn: variable dereferenced before check 'ni'

Moves the ntfs_debug() call after the NULL pointer checks to ensure safe
access to the structure members.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent 11f7a6d9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2913,12 +2913,12 @@ int ntfs_attr_open(struct ntfs_inode *ni, const __le32 type,
	struct ntfs_inode *base_ni;
	int err;

	ntfs_debug("Entering for inode %lld, attr 0x%x.\n",
			(unsigned long long)ni->mft_no, type);

	if (!ni || !ni->vol)
		return -EINVAL;

	ntfs_debug("Entering for inode %lld, attr 0x%x.\n",
			ni->mft_no, type);

	if (NInoAttr(ni))
		base_ni = ni->ext.base_ntfs_ino;
	else