[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjkqz42CNjDgWA9U3uNWa9GriqaCqqKciqm0sZUYjfLQg@mail.gmail.com>
Date: Thu, 10 Mar 2022 17:42:34 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Barnabás Pőcze <pobrn@...tonmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Xiaomeng Tong <xiam0nd.tong@...il.com>,
Kees Cook <keescook@...omium.org>,
Jakob Koschel <jakobkoschel@...il.com>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [RFC PATCH v1 1/2] list: add type-safer list_head wrapper
On Thu, Mar 10, 2022 at 5:33 PM Barnabás Pőcze <pobrn@...tonmail.com> wrote:
>
> The underlying idea is to define each list head using an anonymous struct:
Why struct? Union is much better, and doesn't pointlessly waste memory
for members that are only used for their type.
Anyway, as far as I can tell, your model is unworkable as-is, since it
only works for a list that is external to the types in question.
Which is not even remotely the interesting case. All serious list uses
are inside other types, and refer to each other.
So this seems to be fundamentally broken, in that it only works for
trivial things, and is not even as good as
https://lore.kernel.org/all/CAHk-=wiacQM76xec=Hr7cLchVZ8Mo9VDHmXRJzJ_EX4sOsApEA@mail.gmail.com/
that actually converted a real case.
That one didn't do the automatic offset thing, but see
https://lore.kernel.org/all/CAADWXX-Pr-D3wSr5wsqTEOBSJzB9k7bSH+7hnCAj0AeL0=U4mg@mail.gmail.com/
on the problems that has.
Again, you avoided those problems by making the use-case a narrow and
uninteresting one.
Linus
Powered by blists - more mailing lists