Message ID | 20231031124900.19597-2-abelova@astralinux.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp210929vqg; Tue, 31 Oct 2023 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOYnPIqNejZZj+oetU4NB+7Ml8P1SS9Oi8GnyYoo7bbE7MWr8lfWrNJtt1R1A+VBpn4iQn X-Received: by 2002:a05:6358:591e:b0:168:df94:8dbc with SMTP id g30-20020a056358591e00b00168df948dbcmr15144868rwf.26.1698756606524; Tue, 31 Oct 2023 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698756606; cv=none; d=google.com; s=arc-20160816; b=KRX/mB6AizzTSaYxYv/I51UpWJtXA0vNeA3pRCChU8e0/pak65Z4YA/Rh3pee3aRek DuJi7vFYaTBOTB9eL9JK9xrYX6mF6yqhwVu6kKIDLMqzzTos1kygB9IBqyR7LYlTGd0W KBozxk/jFmuqXACMJdy+uDoMXzTxEEMsGkAHREdwBc+5O6CJIFvP1xxLbp744i38q1dX znxW+dLHphVmu6tuW9Lgba4S4D9+6PSe2HV+K+zMDEYZLLpwUQf5cLbqBHnTzMc+b1xV 0NB+p1WSDephtHM7UeB6MjvhpR+JuXBEbG3L97mqhcWj5apwfceYyLChn9TP71935RoM AfLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Yu82kMgMTnX2hGzdkUTWUfvRDLvDxFp7WJBTGm4FZR0=; fh=uGgBrLNQNf7Vbe71oX97SpxO5j29DZHNnULPFgpE9hA=; b=kQYbaSNVVx6A0avYwkP9L7WCgrCj/FlAY5+9ozDQwIIyuQxB5dO4etTDN/LnnI8ZNj /xTG7ZMhNio6kpQKZqBRWSrg99sX+2Em3+3hyGLhuUxQLhtK0a4vywZc+5rUYxzb4ibl gD42jHZbbWKk7gZEQgIpBWWm/Wqh0zdUf+TGxHbFVLdYjQtXyixGdxwHdNGrYGGlLbnS rSgCOSktPaOuRpe12bzGQOrrD2B0mA5/eTyejuLdXvfijRF3RfsWCGarRSPk/Omb3n60 hbCowBZk72qtROufJ27cOP3eXIN6waa74yUJzN/I9EGKjt0SAlzA+0iKbY8gMYFpk853 yQ7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bq4-20020a056a02044400b005ae05010bc4si1008814pgb.235.2023.10.31.05.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 585BD80212B1; Tue, 31 Oct 2023 05:50:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344363AbjJaMt4 (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 08:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344275AbjJaMtz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 08:49:55 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E0E198; Tue, 31 Oct 2023 05:49:53 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 5A6551866427; Tue, 31 Oct 2023 15:49:51 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id CkVqd0bM08iK; Tue, 31 Oct 2023 15:49:51 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id E0D711865CE5; Tue, 31 Oct 2023 15:49:50 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id b1zKP5TFxIGe; Tue, 31 Oct 2023 15:49:50 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.58]) by mail.astralinux.ru (Postfix) with ESMTPSA id A72141863FF6; Tue, 31 Oct 2023 15:49:49 +0300 (MSK) From: Anastasia Belova <abelova@astralinux.ru> To: Chris Mason <clm@fb.com> Cc: Anastasia Belova <abelova@astralinux.ru>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com>, Dennis Zhou <dennis@kernel.org>, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org Subject: [PATCH 5.10 1/1] btrfs: fix region size in count_bitmap_extents Date: Tue, 31 Oct 2023 15:49:00 +0300 Message-Id: <20231031124900.19597-2-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231031124900.19597-1-abelova@astralinux.ru> References: <20231031124900.19597-1-abelova@astralinux.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 31 Oct 2023 05:50:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781275407713182256 X-GMAIL-MSGID: 1781275407713182256 |
Series |
btrfs: fix region size in count_bitmap_extents
|
|
Commit Message
Anastasia Belova
Oct. 31, 2023, 12:49 p.m. UTC
Region size should be calculated by subtracting
the end from the beginning.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: dfb79ddb130e ("btrfs: track discardable extents for async discard")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
fs/btrfs/free-space-cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 4989c60b1df9..a34e266a0969 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1930,7 +1930,7 @@ static int count_bitmap_extents(struct btrfs_free_space_ctl *ctl, bitmap_for_each_set_region(bitmap_info->bitmap, rs, re, 0, BITS_PER_BITMAP) { - bytes -= (rs - re) * ctl->unit; + bytes -= (re - rs) * ctl->unit; count++; if (!bytes)