aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
authorSteven Rostedt <rostedt@goodmis.org>2026-05-12 17:56:23 -0400
committerAndrew Morton <akpm@linux-foundation.org>2026-05-28 21:31:00 -0700
commit29eede7c3158bf5fa971392e38573750c1f8f6b7 (patch)
tree60a8b5e12ce6af60ca4f376fd52f9c388750e1be /lib
parente9ce6e79bd6bc760044bfbf9ba405678781c2ac9 (diff)
downloadlinux-next-history-29eede7c3158bf5fa971392e38573750c1f8f6b7.tar.gz
maple_tree: document that "last" in mtree_insert_range() is inclusive
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. Link: https://lore.kernel.org/20260512175623.4c5ca8d2@gandalf.local.home Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: "Liam R. Howlett" <liam@infradead.org> Acked-by: SeongJae Park <sj@kernel.org> Cc: Alice Ryhl <aliceryhl@google.com> Cc: Andrew Ballance <andrewjballance@gmail.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/maple_tree.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 60ae5e6fc1ee6..e52876435b77f 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5727,13 +5727,16 @@ int mtree_store(struct maple_tree *mt, unsigned long index, void *entry,
EXPORT_SYMBOL(mtree_store);
/**
- * mtree_insert_range() - Insert an entry at a given range if there is no value.
+ * mtree_insert_range() - Insert an entry from [first, last] 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 (inclusive)
* @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.
*/