From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E99E747F2EE for ; Wed, 6 May 2026 14:52:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778079156; cv=none; b=jf7rn/9e3MKtghYRUFu3d1HS0J9/Xydz5ATfR9M5BYNkh97lx0MzPZQoChfGetJx0Cy0iQVrzV5wOT6sBoAxdeu64sOTvAkz4M6sqJ2q5NV6FQJK8yoEijXafn82lwbGZNb2wfLqLNhwk0EVpNVIW546veZEQOL+BW6ODQYgKN4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778079156; c=relaxed/simple; bh=Gi7f6b/qBwKsdQPOp8u30fJ18Kn/iyNR0NI+MBi41pU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=uX+QQ68Epsf8pOoHDeCYMTU/L/ypGWCzuEI89B4pjkcORAIdqEoKR9Z5noZVjkwvX35/6iACU5IajJ/6sgTNw2Qb5gFb3zDwRdVq7j7ql5Qb4DpjMqszxFbE9F6FjRlatzmJFlM1qoB9cwE3wItxq9GCTd8O3zrn5DogCkPiotk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org Received: from omf10.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BB98C1201A0; Wed, 6 May 2026 14:52:23 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf10.hostedemail.com (Postfix) with ESMTPA id 1006632; Wed, 6 May 2026 14:52:20 +0000 (UTC) Date: Wed, 6 May 2026 10:52:18 -0400 From: Steven Rostedt To: "Liam R. Howlett" Cc: LKML , linux-mm@kvack.org, Alice Ryhl , Andrew Ballance , maple-tree@lists.infradead.org, Andrew Morton , Matthew Wilcox Subject: [PATCH] maple_tree: document that "last" in mtree_insert_range() is inclusive Message-ID: <20260506105218.2d027cc0@fedora> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: ncisdeq875sqa38bbiypch7kffh8yhj9 X-Rspamd-Server: rspamout02 X-Rspamd-Queue-Id: 1006632 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX1+kj9YBeXscDLq874zLU7zgLj+l26bmBXA= X-HE-Tag: 1778079140-721101 X-HE-Meta: U2FsdGVkX1/cgatkWo0EqaahDtKU5HPgw4gZTQ81Jbc7hM1/Geamd84zEdzF4AarhJyAm3mXQ3yqp5ltGn3PXHhfD8NieJ5oteyfMkoXHDjiAd1NvGu7Moz8SjjRfuaT91qXlvUjjXFiMHzELM/XZJ+rWSmwGgF+4ZBzKGN0Ta5n+KYhfQwGB8tKNR1OD0djayL0umKSJ9K4P1B7pfZfG6PGJRYe8AEuHFzQe9ULCyyKlcbeKgmMeFPD0Ta7IOMdc4mz6XiM0greIEBTpnIDX0+CdmWese6GKnGqkevdD1saAkTwHPy056V4+CTA097VPMu+aW6F7iGXhsF7zRNsHZKqd71c3Ym1OeYfd9D4OF+ADLj3YgDE84T7i6qzCS+h From: Steven Rostedt The kernel doc of mtree_insert_range() does not state if the address represented by the "last" parameter is inclusive or exclusive. This can lead to bugs by code that assumes it is exclusive. Explicitly state that the parameter is inclusive, and add '[' and ']' around the word "end" to also stress this point. Signed-off-by: Steven Rostedt --- lib/maple_tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 60ae5e6fc1ee..dc9591218446 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5730,10 +5730,12 @@ EXPORT_SYMBOL(mtree_store); * mtree_insert_range() - Insert an entry at a given range if there is no value. * @mt: The maple tree * @first: The start of the range - * @last: The end of the range + * @last: The [end] of the range * @entry: The entry to store * @gfp: The GFP_FLAGS to use for allocations. * + * Note that @last is inclusive. That is, @last = @first + length - 1; + * * Return: 0 on success, -EEXISTS if the range is occupied, -EINVAL on invalid * request, -ENOMEM if memory could not be allocated. */ -- 2.53.0