From patchwork Tue Mar 7 16:03:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 65687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2529787wrd; Tue, 7 Mar 2023 08:35:48 -0800 (PST) X-Google-Smtp-Source: AK7set/NMJDJHOTVRLFlb5hJLcyCuRHT9WJ9OQaa9XsScf7axVLkATuPuGLh0TtgMPujUQuGdp3V X-Received: by 2002:a17:906:dac9:b0:8aa:c090:a9ef with SMTP id xi9-20020a170906dac900b008aac090a9efmr19483000ejb.55.1678206948510; Tue, 07 Mar 2023 08:35:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678206948; cv=none; d=google.com; s=arc-20160816; b=j5pcRqs1cwPcltBgijq0aeQPHKFRY4k87TrAQPfqfYdEUvXwf05QACnBzC48/UpaDW SxAhpFv8Bj9MwRmFllrmPO7ArTwbpeAgWEuRWT3AiVVb9by+C+tu9D/A4UirQ9Sgp9Pk m6kABmh+mbsycEcUoEYIXM04JMpPGqykeg/6ToS9cynbO2rw53nRJMo4CpY1iR4FJlsz z1mKLO8ryTjxYd8t56Et2CoTo6IeYhMcbDHIxfwoBu2AgJDJhb32GM4/9CPfAIqSiXE+ 6telOLrFvX2MLRacTztaFp79YVNBB0ua7ZhoPzVv23X0x/aM4jJ9bvvvKQcIZqBJrNnb MRqw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=G7hLcya3bsLv//yf0JprtSrDFewhrMQT5YQLYtI/Y+8=; b=PaLVdya6fmdUsxXHMIWM7LjBCeq5T1zJtStbLO0ezvw/juRICBuEujzwh7h2U6YEOM rulEEbCTuHDtSFMvPTRka9z9jkANit0jAR/EYWFC0j0bd601itXhm55kBt+95nPgxGhz WW3EKHto2W4fdaYcvGL7zL3yLYDmjr7rjWs2BklHMJUrIVTK/WiYBhOkfJketMk6keWY /HkkJZ6w3U5ldSwgB+/lFuvgYgJd579obigaCUPWQ99ka96V/Zv/SPj3e4hNbzDqucSD Fk8Re23vCDauVIshtrDCEnR9o7Hkn7RzYvd/qtE2UTLXA69VRjTXcFA3RzyrQXcOuVGv tCiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=HhlJAwr8; 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=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ig2-20020a1709072e0200b008b178b93488si3630283ejc.135.2023.03.07.08.35.24; Tue, 07 Mar 2023 08:35:48 -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=@bytedance.com header.s=google header.b=HhlJAwr8; 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=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbjCGQG0 (ORCPT + 99 others); Tue, 7 Mar 2023 11:06:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjCGQFy (ORCPT ); Tue, 7 Mar 2023 11:05:54 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A84E57B11A for ; Tue, 7 Mar 2023 08:03:50 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id h8so14576362plf.10 for ; Tue, 07 Mar 2023 08:03:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1678205030; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=G7hLcya3bsLv//yf0JprtSrDFewhrMQT5YQLYtI/Y+8=; b=HhlJAwr8DqmGWUQSQKG77Mn/Gh6yYYR1j2fGKcMErDoLU/2WO4w78tvQGmo8qzz+Bd z+vLe76wWlESF6KvD5zv8SeC+NAvZI2OhNtVa9jLuWq4nDxOG0mZ08GuWIQ40j0ve47d wCNyjXMH15KF/Lpl90NsfZWOhDLQT55jBjeZV/k5txBnAGDsY8KeEu55sl6W4ZjYnJzp PJilrxuNUwsZ1en+/W/K3Dx1Nuza0C8iW4/1LFjiIRH4BesAKN2JMUmORh0abKLxfa8O 9FUU+5gIIQldomfJ4kYWMctWkgmHx1rBLoa3jLT643ykt0S5GIx5oKwqmS3Exzn5j4tf xmag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678205030; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=G7hLcya3bsLv//yf0JprtSrDFewhrMQT5YQLYtI/Y+8=; b=6aEoTReDOEU07fi6+LPFviwSgmw8irLwYkX/JpobGkcNmuGeg4Ruq/5PJHFmEn0okr 6ZBfc1krUn6QG/O7qnWS6MWBc3RCsWxj8uIw2ASkgMXnkWK8e04ouyjxb/EeJld+4Hb1 Ob0oZ4vuzSIXIsEyeRecwpADzc1kDS4AJtWJN0+WDaow08f/2IqKhRvM9+NJ0C3XLu8r kE4TCOitmHvLOvpLNxuArmO0imhICeF4i4XUWyvNON1jEYFLKtjL4BtTjRWu2BG39lT6 r2BSstItHUtTO4Xz+xyWXzujtO/NuUA/LVInxHQ8gxBc+ANd1+v+PCMmPM7yafPSsi6A jSnw== X-Gm-Message-State: AO0yUKVP0XmW6dYf7FNQucS6tPbN9BSyOuVe0hBow3NM/my9NGQCMYai M5w8x5WDUDH13thAqsW6kefbOQ== X-Received: by 2002:a05:6a20:8e0a:b0:c7:af88:3c8f with SMTP id y10-20020a056a208e0a00b000c7af883c8fmr19601953pzj.25.1678205030119; Tue, 07 Mar 2023 08:03:50 -0800 (PST) Received: from GL4FX4PXWL.bytedance.net ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id m3-20020a635803000000b00502fdc69b97sm7900009pgb.67.2023.03.07.08.03.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Mar 2023 08:03:49 -0800 (PST) From: Peng Zhang To: Liam.Howlett@oracle.com, snild@sony.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Stable@vger.kernel.org, Peng Zhang Subject: [PATCH] maple_tree: Fix the error of mas->min/max in mas_skip_node() Date: Wed, 8 Mar 2023 00:03:40 +0800 Message-Id: <20230307160340.57074-1-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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?1759727196552958963?= X-GMAIL-MSGID: =?utf-8?q?1759727529231247224?= The assignment of mas->min and mas->max is wrong. mas->min and mas->max should represent the range of the current node. After mas_ascend() returns, mas-min and mas->max already represent the range of the current node, so we should delete these assignments of mas->min and mas->max. Signed-off-by: Peng Zhang --- lib/maple_tree.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f5bee48de569..d4ddf7f8adc7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5157,9 +5157,6 @@ static inline bool mas_rewind_node(struct ma_state *mas) */ static inline bool mas_skip_node(struct ma_state *mas) { - unsigned long *pivots; - enum maple_type mt; - if (mas_is_err(mas)) return false; @@ -5173,14 +5170,7 @@ static inline bool mas_skip_node(struct ma_state *mas) mas_ascend(mas); } } while (mas->offset >= mas_data_end(mas)); - - mt = mte_node_type(mas->node); - pivots = ma_pivots(mas_mn(mas), mt); - mas->min = pivots[mas->offset] + 1; mas->offset++; - if (mas->offset < mt_slots[mt]) - mas->max = pivots[mas->offset]; - return true; }