lkml.org 
[lkml]   [2023]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 5/5] virt: sevguest: Add TSM_REPORTS support for SNP_{GET, GET_EXT}_REPORT
Peter Zijlstra wrote:
> On Mon, Aug 14, 2023 at 12:43:38AM -0700, Dan Williams wrote:
> > +static u8 *sev_report_new(struct device *dev, const struct tsm_desc *desc,
>
> > + size_t *outblob_len)
> > +{
>
> > +
> > + u8 *buf __free(kvfree) = kvzalloc(size, GFP_KERNEL);
> > +
>
> > +
> > + *outblob_len = size;
> > + no_free_ptr(buf);
> > + return buf;
>
> This seems broken, no_free_ptr(x) is basically xchg(X, NULL) (except no
> atomics). So the above would end up being:
>
> return NULL;
>
> What you want to write is somehting like:
>
> return no_free_ptr(buf);
>
> or, a convenient shorthand:
>
> return_ptr(buf);
>

Oh, I indeed did not realize that no_free_ptr() had side effects beyond
canceling the free when the variable goes out of scope. Will switch to
return_ptr().

\
 
 \ /
  Last update: 2023-08-14 18:27    [W:0.146 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site