[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wix3KGMBAR52LexxvJA4b6aSbsh8b60JFXig2Rdvp_2qQ@mail.gmail.com>
Date: Fri, 15 Sep 2023 14:25:48 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Alexey Dobriyan <adobriyan@...il.com>,
linux-kernel@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>,
akpm@...ux-foundation.org
Subject: Re: Buggy __free(kfree) usage pattern already in tree
On Fri, 15 Sept 2023 at 14:18, Peter Zijlstra <peterz@...radead.org> wrote:
>
> Hmm, perhaps I can do a class for it and write the thing like:
.. crossed emails.
Yes.
Except I think a full-fledged class thing is overkill for a one-time
use, and I think you really could just write it out as plain "this is
the constructor, this is the cleanup".
Yes, yes, that is obviously what our CLASS() thing *is*, but at least
my personal mental model is that a "class" is for when you really
export it to other uses.
If you just have a one-off, you don't need the class abstraction to
export to anybody else. You just do a one-off "alloc like this, free
like this".
Again, this I think is really just a "mental model" rather than any hard rule.
Linus
Powered by blists - more mailing lists