From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E66B533D6FD for ; Thu, 7 May 2026 06:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778136298; cv=none; b=c4lochzfVW9zfHBBLq6EEgvz3V5zpjtkfv06dwvDHTu1e66Q/LA6nCCD/OC0hZfmfFnx3821aBnDkfOjEJNG12Qcq3nH5gxkgf9cpDzJ6RI87xL27mMM0n5Voal7OYyqwC7lOsgqOY0ljelhd1jijnQHjEP3tGhIHmtLfBnLp10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778136298; c=relaxed/simple; bh=8w/DmXgWV4O3IA09yIYnI+ye5G0aCAHc7N1QtMVywuY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cKuTehsPsKm0CjL3ZzDjgAmrkMZslk+p6KKMKRQtb/NNxy23Yhi7p+uoBoAj4QO0PGlqna+1p5ih1BWOKK0kG0nMXWABfrGSoo5IAOkOP3KN48ElDynTfEvOtn9mg2B7KyWTdOk0A1Mn/zBsmrytBb6aOWAgfnpmrLH1LMIRcZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hvnXtRzg; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hvnXtRzg" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-488dcaf2f2fso3316595e9.0 for ; Wed, 06 May 2026 23:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778136295; x=1778741095; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KanSvF/vheS4526j9LXW3DP+vM38eLB21WEJsAnBSw8=; b=hvnXtRzgVHdh4BQbAJXnQuAAaRFB4+ns0HFhkV957S5tq0Y4DGO977botlrtXjHAWE qcNPsuMj5oznWKkBAWVSsgUfSkyeVq0zt7AcfedHuBNfYQb3bIhH2GxDWLRUwhOXukvg YLdcgrTPIT30rlF7MGmVD/pp3ahixS3BHfSAiTYsFZRoz6gvnL4ozRM2BXzf01y9cKhs Pk6zdL8haoucAqZ0snQSy98BfCvIZ7Yfq8iSXgdCqPLzBhmOsYhPAVDXJA73e6eViGpN 2QRtuRtGJ0WUyOoFgUDo3F2nI2dlf1Xq2yXtjEJ53b0FE50UB8vntMoUwOHbnSr6kmgV g7GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778136295; x=1778741095; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KanSvF/vheS4526j9LXW3DP+vM38eLB21WEJsAnBSw8=; b=RBzfMXTVsg8qyTc1dR4z8I32zj/2bg57bpQiplF2pmk6vCI+ErBils5vsqZi8biEIW vkn93nulAART1Q95nIkMri1j5nCZPRL2zvTZajhWtopXiUCItQMXmkJmQtGNPU4ySKHs KtScs3n2x3jzvOFTyTVHswYEuXrJnf+0Jd+JHrTlcA8wS+kxE+oOPoKp3rbA8V0xoTjp dGRLtQtFBpjQJTgzNisBHJTOjL4ixRh5bme8OGr7DMPlcwEomrELopfoTvrRNb7jBww2 PRvYOOahGL4/lFMzbPbPsJCEH3C/RyTlsehSGGUTUWMsPAwNAi6Pb/Yh5dyzss3VUbfZ c1jA== X-Forwarded-Encrypted: i=1; AFNElJ9lmexbOZ+Wnn/XCeUDWIoBQF5MNX0X1ewHjh6N9UYpsCkVof9WTTCuxQO5Dz39cQrgEkJocfWMdN9gtrU=@vger.kernel.org X-Gm-Message-State: AOJu0Yzt8Qk2pw4CC4AKaEu1tYVAyPnZAsw8O3a/mng9ji7I1Irf+lJF RK9tjirtNVbAmSnr5rxH3s+ZaaXWXrk8oEMyZnhXhrtMRPeSVHpDVWVqQC2QuDQZPrqtryDlVu7 e1R8uAGtllQoGwnsSkw== X-Received: from wmbjx5.prod.google.com ([2002:a05:600c:5785:b0:48a:58a1:abd4]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3b96:b0:48a:66a8:9981 with SMTP id 5b1f17b1804b1-48e51f55272mr113922875e9.27.1778136295060; Wed, 06 May 2026 23:44:55 -0700 (PDT) Date: Thu, 7 May 2026 06:44:53 +0000 In-Reply-To: <20260506105218.2d027cc0@fedora> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260506105218.2d027cc0@fedora> Message-ID: Subject: Re: [PATCH] maple_tree: document that "last" in mtree_insert_range() is inclusive From: Alice Ryhl To: Steven Rostedt Cc: "Liam R. Howlett" , LKML , linux-mm@kvack.org, Andrew Ballance , maple-tree@lists.infradead.org, Andrew Morton , Matthew Wilcox Content-Type: text/plain; charset="utf-8" On Wed, May 06, 2026 at 10:52:18AM -0400, Steven Rostedt wrote: > 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 Reviewed-by: Alice Ryhl > 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; How about writing it like this? * @first: The start of the range * @last: The end of the range (inclusive) Alice