From patchwork Fri Dec 30 11:27:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 37648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2845633wrt; Fri, 30 Dec 2022 03:31:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXu9UFuidylci9EUnps/KCo9sg2qXhPle9a4yEyDTCbkpA6Xz0G+zOiE6MP3W8PYQrIUjsX0 X-Received: by 2002:a17:907:2155:b0:7c0:c1cf:f9e8 with SMTP id rk21-20020a170907215500b007c0c1cff9e8mr32265988ejb.30.1672399865476; Fri, 30 Dec 2022 03:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672399865; cv=none; d=google.com; s=arc-20160816; b=ysXz7p7sZNySxIoPQIkYHYdHeFrrmCpKvTxg2yTbKAVE4XT1ehDDLmuehYwuyq03Of gMbjtuOGcDI23zBhH0kHoUf9esiJaRbfSrVi9mIiMWVyju/uWEdW/lBQCe9iSIV4pZJC oxEymU7Ejmp6Wb++pj1Kd9MvsVOW4XBpYD5b1ziSTq5wvXssE4TM6yN/2TwiBvSYMbx5 OlqaWhgdo7PvevNcrq5Oyzo7/yhkSa3tvavnQm5CtOl5Od7usMl7QzakpyAkjCq2VmjL rGGyiVSLyM8Wr8QIG5P/W6lIX0OK0+YMbINJF9DTZe2qiKDA+ehlKSHXp3FD0N/W4EA4 3mqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=ETfFUvoUKgLpON3I17vb6pr52MbHQUStImHG554hLLg=; b=TZCeUMIO7B9go9U4zyFYcES+Wp778KdKfraKWxjUGT8HvvjUd8CPnbbPIPbKnKHY9c A3gV/yCH6/AN0lejSh0VelaxxDXewfSBUzzCUa9eC1/WZVohAjg+kKz4g7yujFmWjKaz iUJCcuVP3k0gMZs3um2W3LQaa7SalTSH1+9hHlW68r6+7zN5E5yZsq0QwaGX2GhoDaLV +fyCFF18Vh5CBIrCQr/MIrXmxURmccAmeTPjSX+d+ywCBwcjQqJwziw2GKz+AXMZebZ1 QAmV/bxIoJK6FyZ5MzFJJevazRR/iAzoeEetZzehqnKLzxOpEMUNy1XXFWYnXfPdP38K eKnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=m3uMIOY0; dkim=pass header.i=@paragon-software.com header.s=mail header.b=d+FBdD87; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xj4-20020a170906db0400b0079800b8172bsi18694014ejb.450.2022.12.30.03.30.40; Fri, 30 Dec 2022 03:31:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=m3uMIOY0; dkim=pass header.i=@paragon-software.com header.s=mail header.b=d+FBdD87; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234904AbiL3L1H (ORCPT + 99 others); Fri, 30 Dec 2022 06:27:07 -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: 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) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753638361723792543?= X-GMAIL-MSGID: =?utf-8?q?1753638361723792543?= Removed unused macro. Changed null pointer checking. Fixed inconsistent indenting. Signed-off-by: Konstantin Komarov ---  fs/ntfs3/bitmap.c  | 3 ++-  fs/ntfs3/frecord.c | 2 +-  fs/ntfs3/fsntfs.c  | 6 ++++--  fs/ntfs3/namei.c   | 2 +-  fs/ntfs3/ntfs.h    | 3 ---  5 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 super_block *sb, size_t nbits)      if (!wnd->bits_last)          wnd->bits_last = wbits; -    wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS | __GFP_NOWARN); +    wnd->free_bits = +        kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS | __GFP_NOWARN);      if (!wnd->free_bits)          return -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 ntfs_inode *ni,  {      struct ATTRIB *attr = NULL;      struct ATTR_FILE_NAME *fname; -       struct le_str *fns; +    struct le_str *fns;      if (le)          *le = 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 ntfs_sb_info *sbi,      if (len == 4 || (len > 4 && le16_to_cpu(name[4]) == '.')) {          port_digit = le16_to_cpu(name[3]);          if (port_digit >= '1' && port_digit <= '9') -            if (!ntfs_cmp_names(name, 3, COM_NAME, 3, upcase, false) || -                !ntfs_cmp_names(name, 3, LPT_NAME, 3, upcase, false)) +            if (!ntfs_cmp_names(name, 3, COM_NAME, 3, upcase, +                        false) || +                !ntfs_cmp_names(name, 3, LPT_NAME, 3, upcase, +                        false))                  return true;      } 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, struct dentry *dentry,       * If the MFT record of ntfs inode is not a base record, inode->i_op can be NULL.       * This causes null pointer dereference in d_splice_alias().       */ -    if (!IS_ERR(inode) && inode->i_op == NULL) { +    if (!IS_ERR_OR_NULL(inode) && !inode->i_op) {          iput(inode);          inode = ERR_PTR(-EINVAL);      } 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)      return attr->non_res ? le64_to_cpu(attr->nres.svcn) : 0;  } -/* The size of resident attribute by its resident size. */ -#define BYTES_PER_RESIDENT(b) (0x18 + (b)) -  static_assert(sizeof(struct ATTRIB) == 0x48);  static_assert(sizeof(((struct ATTRIB *)NULL)->res) == 0x08);  static_assert(sizeof(((struct ATTRIB *)NULL)->nres) == 0x38);