summaryrefslogtreecommitdiffstats
path: root/fs/ntfs3
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-10-05 19:33:26 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-10-11 19:28:06 +0300
commit22b05f1ac0332cb47701649206997d8d9a1a7f24 (patch)
tree226d10c59b50273dedac0260d0dc67c42a08c9e5 /fs/ntfs3
parentcd4c76ff807c1afeed89f1b7e311760c0e296349 (diff)
downloadlinux-stable-22b05f1ac0332cb47701649206997d8d9a1a7f24.tar.gz
linux-stable-22b05f1ac0332cb47701649206997d8d9a1a7f24.tar.bz2
linux-stable-22b05f1ac0332cb47701649206997d8d9a1a7f24.zip
fs/ntfs3: Refactor ntfs_read_mft
Don't save size of attribute reparse point as size of symlink. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r--fs/ntfs3/inode.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index bdebbbd53e76..859951d785cb 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -222,9 +222,6 @@ next_attr:
if (!attr->non_res) {
ni->i_valid = inode->i_size = rsize;
inode_set_bytes(inode, rsize);
- t32 = asize;
- } else {
- t32 = le16_to_cpu(attr->nres.run_off);
}
mode = S_IFREG | (0777 & sbi->options->fs_fmask_inv);
@@ -313,17 +310,14 @@ next_attr:
rp_fa = ni_parse_reparse(ni, attr, &rp);
switch (rp_fa) {
case REPARSE_LINK:
- if (!attr->non_res) {
- inode->i_size = rsize;
- inode_set_bytes(inode, rsize);
- t32 = asize;
- } else {
- inode->i_size =
- le64_to_cpu(attr->nres.data_size);
- t32 = le16_to_cpu(attr->nres.run_off);
- }
+ /*
+ * Normal symlink.
+ * Assume one unicode symbol == one utf8.
+ */
+ inode->i_size = le16_to_cpu(rp.SymbolicLinkReparseBuffer
+ .PrintNameLength) /
+ sizeof(u16);
- /* Looks like normal symlink. */
ni->i_valid = inode->i_size;
/* Clear directory bit. */
@@ -420,7 +414,7 @@ end_enum:
ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
inode->i_op = &ntfs_link_inode_operations;
inode->i_fop = NULL;
- inode_nohighmem(inode); // ??
+ inode_nohighmem(inode);
} else if (S_ISREG(mode)) {
ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
inode->i_op = &ntfs_file_inode_operations;