From patchwork Fri Oct 28 17:05:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 12491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp944495wru; Fri, 28 Oct 2022 10:09:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VZbOIhtWizU4Ud0cyOG8QmgWKfFo1yz4NZ4VrUi2+jwLkc4rh4YQNd2SGBGWv8Ujn19di X-Received: by 2002:a17:907:724d:b0:78d:acf4:4c57 with SMTP id ds13-20020a170907724d00b0078dacf44c57mr316679ejc.516.1666976970623; Fri, 28 Oct 2022 10:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666976970; cv=none; d=google.com; s=arc-20160816; b=GBdGtdr5cT0FDgRBKi5vy+Xt9fuphoyIfiNMnXhqxzTir+nhx0ukKckg6Z56Xm9OjT OvbdtEUxlsBl+chKEFnPMxdf6tjTEJBNDKYh6pP65rmtHdLLApS353cPYHPQ9G8dpe0Q PMzXC5wY/yNlvDvezQGBCfi3SueJmYKgeC70EszO6jbi2RhakDK7FHC5v1Wk96ln+lii z8knvd0EgjUnzBcO7j7pOsssbe8RYsxWjO9rJiSFeOtdjMHJOkNgR8KFdx+AV8pA6I7x xt7Rdw45AABNvr7FTXW/aWqbc+ubW1zZkNn+0i4sQJvPIRxh0b5U/tlvhweZNqtnvQki WZQw== 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=Z1wJrT5mwfguS7h+6tsChzRtdrFWjJ5h0upJpKVRuVk=; b=jMHBTj22mNKQrzulN4Tv4RvFZPv5aF3e+EWlcwC52zx72SlyWPmsXt/kjGEChilUOS oviZGwLFljnvTNuTJXtlHhYAiGThWrSbuH8JobkXQtnDI9fUda6qFBi177bjJ2CZ+Ihe VmuMw5AdVbpLYcx2EH9rdPAK9OnWxmX+m7EspayG6Kto5NMvzPnRV/FYDrh/xbjyL/ra tjc7+RVjCtOi0ZhIM5iWcvlA775iszHaY6RbycU3wMkgjGYFxYrRT7ZEq52ubjA/fOZV apqqgfGtVCu067NWY/pY/2L9xH0LdB/6DdRGpSJ8qbmksBJBz4TGisA1ibRv5Obskno+ NnaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=ap6Jd6Il; dkim=pass header.i=@paragon-software.com header.s=mail header.b="Od8/scn9"; 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 l3-20020a170907914300b0078de536a3cdsi2257277ejs.119.2022.10.28.10.09.06; Fri, 28 Oct 2022 10:09:30 -0700 (PDT) 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=ap6Jd6Il; dkim=pass header.i=@paragon-software.com header.s=mail header.b="Od8/scn9"; 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 S230486AbiJ1RHz (ORCPT + 99 others); Fri, 28 Oct 2022 13:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbiJ1RHf (ORCPT ); Fri, 28 Oct 2022 13:07:35 -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 57C6089916; Fri, 28 Oct 2022 10:05:23 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 9F7C5218D; Fri, 28 Oct 2022 17:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1666976561; bh=Z1wJrT5mwfguS7h+6tsChzRtdrFWjJ5h0upJpKVRuVk=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=ap6Jd6Il508YZcM9lbiU4LL2kgEi4UhNsNWfCnwz82iAyHSOTNCS15nO6A1HsqqAh T3UKIuf6LKcjsfIE0WH7E/wixWbAPAbeuKLxMXFtdYEqwfG93+cA/R4a11d4NWKeeX edS2NmHWt3Xugulc3YadJcy5AWyWed3mdVCIp+3A= 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 9D6C0DD; Fri, 28 Oct 2022 17:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1666976720; bh=Z1wJrT5mwfguS7h+6tsChzRtdrFWjJ5h0upJpKVRuVk=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=Od8/scn9IvuypjfeFrrovmpLjKo9xf74MXtp5mvONypWGUSwprXwoK1UXw3c3YuCk tNECaWd3SGEm8ey2KObVffO0Hctm1mtjqsdBqa6eM0dETSKqGRVN4qratXSr1csDmZ pBIOvXCGCvm2j/GxjuAdWFrVr447zC7AsIjICX5o= Received: from [172.30.8.65] (172.30.8.65) 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, 28 Oct 2022 20:05:20 +0300 Message-ID: Date: Fri, 28 Oct 2022 20:05:20 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: [PATCH 08/14] fs/ntfs3: Correct ntfs_check_for_free_space Content-Language: en-US From: Konstantin Komarov To: CC: , References: In-Reply-To: X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) 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?1747952043807545180?= X-GMAIL-MSGID: =?utf-8?q?1747952043807545180?= zlen in some cases was bigger than correct value. Signed-off-by: Konstantin Komarov --- fs/ntfs3/fsntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index b56ffb4951cc..e5a1f4df0397 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -432,7 +432,7 @@ bool ntfs_check_for_free_space(struct ntfs_sb_info *sbi, CLST clen, CLST mlen) wnd = &sbi->used.bitmap; down_read_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS); free = wnd_zeroes(wnd); - zlen = wnd_zone_len(wnd); + zlen = min_t(size_t, NTFS_MIN_MFT_ZONE, wnd_zone_len(wnd)); up_read(&wnd->rw_lock); if (free < zlen + clen)