Skip to content

Commit d5ca773

Browse files
fs/ntfs3: Fix endian problem
Signed-off-by: Konstantin Komarov <[email protected]>
1 parent 33e7070 commit d5ca773

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

fs/ntfs3/frecord.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ struct ATTRIB *ni_find_attr(struct ntfs_inode *ni, struct ATTRIB *attr,
236236
return attr;
237237

238238
out:
239+
ntfs_inode_err(&ni->vfs_inode, "failed to parse mft record");
239240
ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_ERROR);
240241
return NULL;
241242
}
@@ -1643,14 +1644,13 @@ int ni_delete_all(struct ntfs_inode *ni)
16431644
* Return: File name attribute by its value.
16441645
*/
16451646
struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni,
1646-
const struct cpu_str *uni,
1647+
const struct le_str *uni,
16471648
const struct MFT_REF *home_dir,
16481649
struct mft_inode **mi,
16491650
struct ATTR_LIST_ENTRY **le)
16501651
{
16511652
struct ATTRIB *attr = NULL;
16521653
struct ATTR_FILE_NAME *fname;
1653-
struct le_str *fns;
16541654

16551655
if (le)
16561656
*le = NULL;
@@ -1674,10 +1674,9 @@ struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni,
16741674
if (uni->len != fname->name_len)
16751675
goto next;
16761676

1677-
fns = (struct le_str *)&fname->name_len;
1678-
if (ntfs_cmp_names_cpu(uni, fns, NULL, false))
1677+
if (ntfs_cmp_names(uni->name, uni->len, fname->name, uni->len, NULL,
1678+
false))
16791679
goto next;
1680-
16811680
return fname;
16821681
}
16831682

@@ -2915,7 +2914,7 @@ int ni_remove_name(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
29152914
/* Find name in record. */
29162915
mi_get_ref(&dir_ni->mi, &de_name->home);
29172916

2918-
fname = ni_fname_name(ni, (struct cpu_str *)&de_name->name_len,
2917+
fname = ni_fname_name(ni, (struct le_str *)&de_name->name_len,
29192918
&de_name->home, &mi, &le);
29202919
if (!fname)
29212920
return -ENOENT;

fs/ntfs3/ntfs_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ void ni_remove_attr_le(struct ntfs_inode *ni, struct ATTRIB *attr,
543543
struct mft_inode *mi, struct ATTR_LIST_ENTRY *le);
544544
int ni_delete_all(struct ntfs_inode *ni);
545545
struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni,
546-
const struct cpu_str *uni,
546+
const struct le_str *uni,
547547
const struct MFT_REF *home,
548548
struct mft_inode **mi,
549549
struct ATTR_LIST_ENTRY **entry);

0 commit comments

Comments
 (0)