From nobody Tue Sep 16 20:06:06 2025 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 81864C4167B for ; Fri, 30 Dec 2022 11:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234905AbiL3L1I (ORCPT ); Fri, 30 Dec 2022 06:27:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234884AbiL3L1F (ORCPT ); Fri, 30 Dec 2022 06:27:05 -0500 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61D8E140C0; Fri, 30 Dec 2022 03:27:04 -0800 (PST) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id DF32E20EE; Fri, 30 Dec 2022 11:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1672399410; bh=ETfFUvoUKgLpON3I17vb6pr52MbHQUStImHG554hLLg=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=m3uMIOY07QexW/QEC03Gg3hzd1eiQr6WHOX28Wlpvv/DQ0welfS7ZlvIn0FA2yTeG 8c9BvZsLlZ5lPi2kQjLtpmMa11MfEveTuX3HM0dkq34E4C7o3rDCsh9z6LNRNXfPtJ pJAeW6hfWuFrWihLbj6dvwoD5diqRIXlT+f9e8zM= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 770FF212E; Fri, 30 Dec 2022 11:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1672399622; bh=ETfFUvoUKgLpON3I17vb6pr52MbHQUStImHG554hLLg=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=d+FBdD87msNX675SNfkxg1MWCFE8S9NyJJzohNw8KyCFe/YydT3wivc9wFNptdAyF u0H0UVDLkLjZET1sRa/MM6EdA2Cm3xCLSy/V/X1sMGSnAY1Trb4nObxTfAKxLFclzI BqV+/25izhjLXiOsOuTmLC1FmROtJNErsi/ZS5ZY= 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; Fri, 30 Dec 2022 14:27:01 +0300 Message-ID: Date: Fri, 30 Dec 2022 15:27:01 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: [PATCH 5/5] fs/ntfs3: Refactoring of various minor issues Content-Language: en-US From: Konstantin Komarov To: CC: , 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 Removed unused macro. Changed null pointer checking. Fixed inconsistent indenting. Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/bitmap.c=C2=A0 | 3 ++- =C2=A0fs/ntfs3/frecord.c | 2 +- =C2=A0fs/ntfs3/fsntfs.c=C2=A0 | 6 ++++-- =C2=A0fs/ntfs3/namei.c=C2=A0=C2=A0 | 2 +- =C2=A0fs/ntfs3/ntfs.h=C2=A0=C2=A0=C2=A0 | 3 --- =C2=A05 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index 723fb64e6531..393c726ef17a 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -658,7 +658,8 @@ int wnd_init(struct wnd_bitmap *wnd, struct=20 super_block *sb, size_t nbits) =C2=A0=C2=A0=C2=A0 =C2=A0if (!wnd->bits_last) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0wnd->bits_last =3D wbits; -=C2=A0=C2=A0 =C2=A0wnd->free_bits =3D kcalloc(wnd->nwnd, sizeof(u16), GFP_= NOFS |=20 __GFP_NOWARN); +=C2=A0=C2=A0 =C2=A0wnd->free_bits =3D +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0kcalloc(wnd->nwnd, sizeof(u16), GFP_= NOFS | __GFP_NOWARN); =C2=A0=C2=A0=C2=A0 =C2=A0if (!wnd->free_bits) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return -ENOMEM; diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 912eeb3d3471..1103d4d9a497 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -1645,7 +1645,7 @@ struct ATTR_FILE_NAME *ni_fname_name(struct=20 ntfs_inode *ni, =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=A0=C2=A0=C2=A0=C2=A0 struct le_str *fns; +=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; diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 1f36e89dcff7..342938704cfd 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -2599,8 +2599,10 @@ static inline bool is_reserved_name(struct=20 ntfs_sb_info *sbi, =C2=A0=C2=A0=C2=A0 =C2=A0if (len =3D=3D 4 || (len > 4 && le16_to_cpu(name[= 4]) =3D=3D '.')) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0port_digit =3D le16_to_cpu(nam= e[3]); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (port_digit >=3D '1' && por= t_digit <=3D '9') -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!ntfs_cmp_nam= es(name, 3, COM_NAME, 3, upcase, false) || -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 !ntfs_cmp_names(name, 3, LPT_NAME, 3, upcase, false)) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!ntfs_cmp_nam= es(name, 3, COM_NAME, 3, upcase, +=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=C2=A0 false) || +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 !ntfs_cmp_names(name, 3, LPT_NAME, 3, upcase, +=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=C2=A0 false)) =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=A0return true; =C2=A0=C2=A0=C2=A0 =C2=A0} diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c index 3db34d5c03dc..53ddea219e37 100644 --- a/fs/ntfs3/namei.c +++ b/fs/ntfs3/namei.c @@ -93,7 +93,7 @@ static struct dentry *ntfs_lookup(struct inode *dir,=20 struct dentry *dentry, =C2=A0=C2=A0=C2=A0 =C2=A0 * If the MFT record of ntfs inode is not a base = record,=20 inode->i_op can be NULL. =C2=A0=C2=A0=C2=A0 =C2=A0 * This causes null pointer dereference in d_spli= ce_alias(). =C2=A0=C2=A0=C2=A0 =C2=A0 */ -=C2=A0=C2=A0 =C2=A0if (!IS_ERR(inode) && inode->i_op =3D=3D NULL) { +=C2=A0=C2=A0 =C2=A0if (!IS_ERR_OR_NULL(inode) && !inode->i_op) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0iput(inode); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0inode =3D ERR_PTR(-EINVAL); =C2=A0=C2=A0=C2=A0 =C2=A0} diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 86ea1826d099..90151e56c122 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -435,9 +435,6 @@ static inline u64 attr_svcn(const struct ATTRIB *attr) =C2=A0=C2=A0=C2=A0 =C2=A0return attr->non_res ? le64_to_cpu(attr->nres.svc= n) : 0; =C2=A0} -/* The size of resident attribute by its resident size. */ -#define BYTES_PER_RESIDENT(b) (0x18 + (b)) - =C2=A0static_assert(sizeof(struct ATTRIB) =3D=3D 0x48); =C2=A0static_assert(sizeof(((struct ATTRIB *)NULL)->res) =3D=3D 0x08); =C2=A0static_assert(sizeof(((struct ATTRIB *)NULL)->nres) =3D=3D 0x38); --=20 2.34.1