[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aShUPdV18CIxvV-G@casper.infradead.org>
Date: Thu, 27 Nov 2025 13:38:05 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Jan Sokolowski <jan.sokolowski@...el.com>
Cc: linux-kernel@...r.kernel.org,
Christian König <christian.koenig@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC PATCH 1/1] idr: do not create idr if new id would be
outside given range
On Thu, Nov 27, 2025 at 10:27:32AM +0100, Jan Sokolowski wrote:
> @@ -88,6 +89,11 @@ int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp)
> if (ret)
> return ret;
>
> + if (WARN_ON_ONCE(id < start || (id >= end && end != 0))) {
> + idr_remove(idr, id);
> + return -EINVAL;
> + }
This is certainly the wrong way to fix any problem that does exist.
And it should return -ENOSPC, not -EINVAL. -EINVAL is "the arguments
are wrong", not "the data structure is full".
I'll go read the thread now.
Powered by blists - more mailing lists