[ Sorry, on mobile now, so html crud and no lists ]
On Sat, Mar 15, 2025, 08:56 Kees Cook <kees@xxxxxxxxxx> wrote:
What about making the redundant information the type/var itself instead
of just the size info of the existing API? For example:
ptr = kmalloc_obj(ptr, GFP_KERNEL);
Yes, using "sizeof" and "typeof" on that first argument (for the malloc and then the final cast, respectively) sounds like a fine interface, and it's still obviously visually an assignment.
I think we already have some interfaces like this, I have no objections to that pattern.
Linus