Hello Konstantin Komarov, The patch 4342306f0f0d: "fs/ntfs3: Add file operations and implementation" from Aug 13, 2021, leads to the following Smatch static checker warning: fs/ntfs3/record.c:158 mi_read() warn: potential NULL parameter dereference 'mft_ni' fs/ntfs3/record.c 122 int mi_read(struct mft_inode *mi, bool is_mft) 123 { 124 int err; 125 struct MFT_REC *rec = mi->mrec; 126 struct ntfs_sb_info *sbi = mi->sbi; 127 u32 bpr = sbi->record_size; 128 u64 vbo = (u64)mi->rno << sbi->record_bits; 129 struct ntfs_inode *mft_ni = sbi->mft.ni; 130 struct runs_tree *run = mft_ni ? &mft_ni->file.run : NULL; ^^^^^^ Can mft_ni be NULL? 131 struct rw_semaphore *rw_lock = NULL; 132 133 if (is_mounted(sbi)) { 134 if (!is_mft) { 135 rw_lock = &mft_ni->file.run_lock; 136 down_read(rw_lock); 137 } 138 } 139 140 err = ntfs_read_bh(sbi, run, vbo, &rec->rhdr, bpr, &mi->nb); 141 if (rw_lock) 142 up_read(rw_lock); 143 if (!err) 144 goto ok; 145 146 if (err == -E_NTFS_FIXUP) { 147 mi->dirty = true; 148 goto ok; 149 } 150 151 if (err != -ENOENT) 152 goto out; 153 154 if (rw_lock) { 155 ni_lock(mft_ni); 156 down_write(rw_lock); 157 } --> 158 err = attr_load_runs_vcn(mft_ni, ATTR_DATA, NULL, 0, &mft_ni->file.run, ^^^^^^ Unchecked dereference inside the function. 159 vbo >> sbi->cluster_bits); 160 if (rw_lock) { 161 up_write(rw_lock); 162 ni_unlock(mft_ni); 163 } 164 if (err) 165 goto out; 166 167 if (rw_lock) 168 down_read(rw_lock); 169 err = ntfs_read_bh(sbi, run, vbo, &rec->rhdr, bpr, &mi->nb); 170 if (rw_lock) 171 up_read(rw_lock); 172 173 if (err == -E_NTFS_FIXUP) { 174 mi->dirty = true; 175 goto ok; 176 } 177 if (err) 178 goto out; 179 180 ok: 181 /* check field 'total' only here */ 182 if (le32_to_cpu(rec->total) != bpr) { 183 err = -EINVAL; 184 goto out; 185 } 186 187 return 0; 188 189 out: 190 return err; 191 } regards, dan carpenter