]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ntfs: Place check before dereference
authorEthan Tidmore <ethantidmore06@gmail.com>
Thu, 26 Feb 2026 16:09:04 +0000 (10:09 -0600)
committerNamjae Jeon <linkinjeon@kernel.org>
Fri, 27 Feb 2026 09:43:38 +0000 (18:43 +0900)
commitc418e96754100a9cafd7bff32c83cad746f32781
treeeb35df4faffce0f76b8207c29de7a681830a8e3c
parent7c76484fbb222e82f1db34009eb441d08db0a158
ntfs: Place check before dereference

The variable ni has the possiblity of being null and is checked for it
but, only after it was dereferenced in a log message.

Put check before dereference.

Detected by Smatch:
fs/ntfs/attrib.c:2115 ntfs_resident_attr_record_add() warn:
variable dereferenced before check 'ni' (see line 2111)

fs/ntfs/attrib.c:2237 ntfs_non_resident_attr_record_add() warn:
variable dereferenced before check 'ni' (see line 2232)

Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/attrib.c