From nobody Wed Feb 11 16:11:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6D1AC77B73 for ; Mon, 8 May 2023 12:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234069AbjEHMkL (ORCPT ); Mon, 8 May 2023 08:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233727AbjEHMkI (ORCPT ); Mon, 8 May 2023 08:40:08 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E023DC88; Mon, 8 May 2023 05:39:45 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 4C39321C3; Mon, 8 May 2023 12:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1683549297; bh=6s1aiYUMi1N3V7VNMRBYWUxpu3ZEhCtn4SbHn7Qf7Fg=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=aVk0mrX9MQkqEi99MHlO7uLlgKuUQcXvpr0EXyBauUXaj35rdaVC/KvhvRNxNOBS1 VH0UBergSpSBdZBRl9a1KG61Qyf1wBmdNmNiiVIMBxW7z0CObhot03hGsQ1CsLxZRJ KaWr3N8j91EGcmFDIXvI26wQpNQ5EgtTwhIdwwYE= Received: from [192.168.211.146] (192.168.211.146) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 8 May 2023 15:39:43 +0300 Message-ID: <5915fbe7-5448-6093-4318-a37987953c7a@paragon-software.com> Date: Mon, 8 May 2023 16:39:42 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: [PATCH 09/10] fs/ntfs3: Fix endian problem Content-Language: en-US From: Konstantin Komarov To: CC: Linux Kernel Mailing List , References: In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.146] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/frecord.c | 11 +++++------ =C2=A0fs/ntfs3/ntfs_fs.h |=C2=A0 2 +- =C2=A02 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index be59bd399fd1..16bd9faa2d28 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -236,6 +236,7 @@ struct ATTRIB *ni_find_attr(struct ntfs_inode *ni,=20 struct ATTRIB *attr, =C2=A0=C2=A0=C2=A0 =C2=A0return attr; =C2=A0out: +=C2=A0=C2=A0 =C2=A0ntfs_inode_err(&ni->vfs_inode, "failed to parse mft rec= ord"); =C2=A0=C2=A0=C2=A0 =C2=A0ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_ERROR); =C2=A0=C2=A0=C2=A0 =C2=A0return NULL; =C2=A0} @@ -1643,14 +1644,13 @@ int ni_delete_all(struct ntfs_inode *ni) =C2=A0 * Return: File name attribute by its value. =C2=A0 */ =C2=A0struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct cpu_str *uni, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct le_str *uni, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct MFT_REF *home_dir, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct mft_inode **mi, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct ATTR_LIST_ENTRY **le) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0struct ATTRIB *attr =3D NULL; =C2=A0=C2=A0=C2=A0 =C2=A0struct ATTR_FILE_NAME *fname; -=C2=A0=C2=A0 =C2=A0struct le_str *fns; =C2=A0=C2=A0=C2=A0 =C2=A0if (le) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0*le =3D NULL; @@ -1674,10 +1674,9 @@ struct ATTR_FILE_NAME *ni_fname_name(struct=20 ntfs_inode *ni, =C2=A0=C2=A0=C2=A0 =C2=A0if (uni->len !=3D fname->name_len) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto next; -=C2=A0=C2=A0 =C2=A0fns =3D (struct le_str *)&fname->name_len; -=C2=A0=C2=A0 =C2=A0if (ntfs_cmp_names_cpu(uni, fns, NULL, false)) +=C2=A0=C2=A0 =C2=A0if (ntfs_cmp_names(uni->name, uni->len, fname->name, un= i->len, NULL, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 fals= e)) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto next; - =C2=A0=C2=A0=C2=A0 =C2=A0return fname; =C2=A0} @@ -2915,7 +2914,7 @@ int ni_remove_name(struct ntfs_inode *dir_ni,=20 struct ntfs_inode *ni, =C2=A0=C2=A0=C2=A0 =C2=A0/* Find name in record. */ =C2=A0=C2=A0=C2=A0 =C2=A0mi_get_ref(&dir_ni->mi, &de_name->home); -=C2=A0=C2=A0 =C2=A0fname =3D ni_fname_name(ni, (struct cpu_str *)&de_name-= >name_len, +=C2=A0=C2=A0 =C2=A0fname =3D ni_fname_name(ni, (struct le_str *)&de_name->= name_len, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 &de_name->home, &mi, &le); =C2=A0=C2=A0=C2=A0 =C2=A0if (!fname) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return -ENOENT; diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 98b61e4b3215..00fa782fcada 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -543,7 +543,7 @@ void ni_remove_attr_le(struct ntfs_inode *ni, struct=20 ATTRIB *attr, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 struct mft_inode *mi, struct ATTR_LIST_ENTRY *le); =C2=A0int ni_delete_all(struct ntfs_inode *ni); =C2=A0struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct cpu_str *uni, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct le_str *uni, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct MFT_REF *home, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct mft_inode **mi, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct ATTR_LIST_ENTRY **entry); --=20 2.34.1