From patchwork Sat Nov 16 01:48:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13877451 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F4D2D68BDF for ; Sat, 16 Nov 2024 01:48:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49AD39C001E; Fri, 15 Nov 2024 20:48:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 423299C0018; Fri, 15 Nov 2024 20:48:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29C109C001E; Fri, 15 Nov 2024 20:48:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 086289C0018 for ; Fri, 15 Nov 2024 20:48:27 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B7A2A140CE1 for ; Sat, 16 Nov 2024 01:48:26 +0000 (UTC) X-FDA: 82790272068.22.E457708 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf09.hostedemail.com (Postfix) with ESMTP id 5195114001B for ; Sat, 16 Nov 2024 01:47:48 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Zr+fu5+3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731721611; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=YcF47OPMgV4gAHSoaTWEjiZTKjXBo70DUlqXu2ApiN8=; b=GK98ztwtscBWyChNE8cgcBqEaTVZ9vs4vNHOOKjPUKULPUTlLq6ukvdhfyAYR25bHMv5lL qQVo5AbquWXisn8ZK/b6CWRmnkvzYAOU5eNeuGXExV6gHuGzxwqHLFq5rN+z25pamV2l5C 0XvWL4RLk2BLqkjooEqoW7UIFt9QxF0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Zr+fu5+3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731721611; a=rsa-sha256; cv=none; b=wugfPdCrpDg4cG9hLuXxd068o0s+YxdkNBjCzBKrmqHz3Kj3dcykG13e5SzCRydpT3qEco cvCP2hbM7vDdMjQRo+FbqpZZfqDlVeH79xarOlXMBk0jaLqh/92952QOS0vUBDHkDH5jrF TrKeRwq1Dg8LTcKn/5RgfZpQh9Sqddk= Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5cefc36c5d4so226977a12.0 for ; Fri, 15 Nov 2024 17:48:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731721699; x=1732326499; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=YcF47OPMgV4gAHSoaTWEjiZTKjXBo70DUlqXu2ApiN8=; b=Zr+fu5+3wh3Vt4gRW8VwNCXFVpOT6V4EmayJY1q9rZ4OyH28O56CUHox/NX8qDhsa8 SU8HvKS1NBKHzhijhou/OFHpU5fGK7Is/e13TPDlQx2ty2H8qIUtHugTWNcGIzBERQGp 9ScTMKVbTSpd6WM/A75q01lGCUZDktJVR63j/99Q3aWs4RiI/5q8Cjj8JImOXwjgJkSV w8vO+NXMd6mbCL4LU/M5Sk8er+fLXImpjFVZokQV1JdlkMe//eQSSown0oTVjA4FL3ye T/ILeYsPPnCZgZL/Fd8HHk0BU4+BG+yBh7seK39w0aG9O6+skr6PIlo+incp8bEKPWsp TZcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731721699; x=1732326499; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YcF47OPMgV4gAHSoaTWEjiZTKjXBo70DUlqXu2ApiN8=; b=ISXlS16bBZrasyRICTO7AUYxg2jMOjiooxJ5nv+fYRIcJAr8x/LbyT5q1BH17DpkWn 30eLRin3d09oRMaPSedrh7RNAK4AZldRxiaPohkNh+B8Fz0UcD83CtInLh3nSSxZTlBV 0yeDUk+deUVUUNDfsp+uBqndc0GAoElRWTUlX7Pbbfwiuu7bcpCi1U72Bpr9d2bVxLUW BqpJe6c6niikvy3Ftlt0dK3gM2ywjDKfn6vhTS9q5u7qNQLNi5/SqqLEBTlAdt2+014y z7UTzUJivqeKbPAT/nbtlxlp4cDCfwZFiR75If1uBT8klTASAHAD8XLcs7/3LO7kmEt1 QeLw== X-Forwarded-Encrypted: i=1; AJvYcCXHw3V7YNSzHm/9/QOj/PhguZi5lOwR9VxhkIhBOYYZDWuo2aVC1oveubAaFPoaqNxpV+3KhulQgQ==@kvack.org X-Gm-Message-State: AOJu0YyKhFpnXmC5lmRYT0UuJ6sT/dg6Za0y45QkC7G+lfPsxjPkiAh/ Hm+qtaOXK0csChPu1F9Q/hqW7Oypwf5PxQf9EB/HISIA12o9b1T4 X-Google-Smtp-Source: AGHT+IE4Zrpc1KBdRyyM6fBOv/K3r/c9TnDCzrAP58hw4DvATPjPIUCoEdgZzlGw7iwdi4loZrfy+Q== X-Received: by 2002:a05:6402:2744:b0:5cf:7473:3317 with SMTP id 4fb4d7f45d1cf-5cf8fd325e5mr3478871a12.24.1731721698456; Fri, 15 Nov 2024 17:48:18 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20df1ca49sm238564466b.3.2024.11.15.17.48.15 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Nov 2024 17:48:16 -0800 (PST) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Lorenzo Stoakes , Sidhartha Kumar Subject: [PATCH 1/3] maple_tree: index has been checked to be smaller than pivot Date: Sat, 16 Nov 2024 01:48:03 +0000 Message-Id: <20241116014805.11547-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241116014805.11547-1-richard.weiyang@gmail.com> References: <20241116014805.11547-1-richard.weiyang@gmail.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5195114001B X-Stat-Signature: ck3senurff38mktx3m1xtt4jpzminawe X-HE-Tag: 1731721668-931344 X-HE-Meta: U2FsdGVkX18JowEC3qo2z7RGStoG0JzfRdDuJOFXhqYrTOeekSbBT0rijHi/+I/WFlLDSzfR/DvX6PTQRRud1MgMc3j/dA73t+1dF2FbmjahZ+Nw46NHSFVUohlXXZtSk19QnGaAfDxxc6VqTKgwtJhfbRFzpf1Wbbf91pNsVmhrYTskrp+yTjMPIUOGl9ndXesL1oi6L/Uk4RdrfHjDKbUhE4V62ltyFLomkeUOctVGoX50nOcMcw+T1HMtdSxYm+RtiWwRvqxRIFC9vqIdeaOptw394Ubl8KsHJmB/NX+kmAxvfL1OBCAdAA9ZFWw0FucjVbInrZ6x62wFAdObblxTscw6+zxV2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m1I7s/2zBPgCm9DfiBWy7Kj2or9lzfhrXiieh8Hhn7AMxvfvyrlbeo6d2UHNGyjMxRO7/YS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000259, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: At the beginning of loop, it has checked the range is in lower bounds. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Lorenzo Stoakes CC: Sidhartha Kumar --- lib/maple_tree.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 667326717f35..63dccd7b9474 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4893,13 +4893,12 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size) found = true; goto done; } - if (mas->index <= pivot) { - mas->node = mas_slot(mas, slots, offset); - mas->min = min; - mas->max = pivot; - offset = 0; - break; - } + + mas->node = mas_slot(mas, slots, offset); + mas->min = min; + mas->max = pivot; + offset = 0; + break; } next_slot: min = pivot + 1;