Re: [PATCH v3 3/4] virt: tdx-guest: Use a variable to store the Quote buffer size

From: Peter Fang

Date: Thu Sep 10 2026 - 17:39:20 EST


On Mon, Sep 07, 2026 at 03:55:22PM +0800, Binbin Wu wrote:
> >>
> >>> @@ -191,8 +191,9 @@ struct tdx_quote_buf {
> >>> u8 data[];
> >>> };
> >>>
> >>> -/* Quote data buffer */
> >>> +/* Quote data buffer and length */
> >>> static void *quote_data;
> >>> +static size_t quote_data_len;
> >>
> >> Nit:
> >> The existing code is using "quote_data", it's natural to follow the style.
> >> I personally feel the var names are a bit ambiguous on whether it's the full
> >> quote buffer or just the data part.
> >
> > Yeah I agree... How about I change it to:
> >
> > static struct tdx_quote_buf *quote_buf;
> >
> > This way it's explicitly typed, and should work better with functions
> > like alloc_quote_buf() and free_quote_buf()?
>
> tdx_report_new_locked() already uses the name 'quote_buf' as a local var. :(
> Maybe the local var can be dropped, but tdx_hcall_get_quote() takes a "u8 *"
> pointer, which will require a type cast.

Yes, the local variable can be dropped and it can just use the global
quote_buf as is.

But yeah some tweaking is required to make tdx_hcall_get_quote() play
nice...

>
> Anyway, this is a nit and it could be addressed in a separately if needed.

OK, I can add it to the cleanup list. Looks like this is more work than
I initially thought. Thanks for the review!

>