lkml.org 
[lkml]   [2023]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 0/2] Lock and Pointer guards
On Thu, Jun 08, 2023 at 07:25:27PM -0700, Linus Torvalds wrote:
> On Thu, Jun 8, 2023 at 1:06 PM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > struct obj *p __free(kfree) = kmalloc(...);
>
> Yeah, the above actually looks really good to me - I like the naming
> here, and the use looks very logical to me.
>
> Of course, maybe once I see the patches that use this I go "uhh", but
> at least for now I think you've hit on a rather legible syntax.
>
> I'm still a bit unsure of the "no_free_ptr(p)" naming, but at least
> it's pretty clear about what it does.
>
> So my only worry is that it's not pretty and to the point like your
> "__free(kfree)" syntax.
>
> But it feels workable and not misleading, so unless somebody can come
> up with a better name, I think it's ok.

#define return_ptr(p) \
return no_free_ptr(p)


struct obj *p __free(kfree) = kmalloc(...);
if (!p)
return ERR_PTR(-ENOMEM);

...

return_ptr(p);

?

\
 
 \ /
  Last update: 2023-06-09 10:17    [W:0.096 / U:1.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site