[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zi_oMFn7HxwC1by4@casper.infradead.org>
Date: Mon, 29 Apr 2024 19:34:24 +0100
From: Matthew Wilcox <willy@...radead.org>
To: "Christoph Lameter (Ampere)" <cl@...ux.com>
Cc: Dan Carpenter <dan.carpenter@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Hyeonggon Yoo <42.hyeyoo@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH] mm/slab: make __free(kfree) accept error pointers
On Mon, Apr 29, 2024 at 09:29:58AM -0700, Christoph Lameter (Ampere) wrote:
> On Mon, 29 Apr 2024, Dan Carpenter wrote:
>
> > I've always thought freeing pointers that have not been allocated is
> > sloppy so I like that kfree() doesn't allow error pointers. We always
> > catch it before it reaches production and that teaches people better
> > habbits. Personally, I like how free_netdev() only accepts valid
> > pointers.
>
> kfree() already checks for NULL and ZERO pointers. We should add these
> checks in *one* location.
>
> Maybe issue a WARN_ONCE() and simply treat it as a NULL pointer if an error
> code is passed?
Did you even read the initial patch? The point is that this new automatic
destructor path can pass error pointers to the destructor for completely
valid code. Warning would completely defeat the purpose of this exercise.
Powered by blists - more mailing lists