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

From: Dave Hansen

Date: Tue Sep 22 2026 - 11:11:43 EST


On 9/22/26 03:05, Xiaoyao Li wrote:
>> @@ -417,7 +416,8 @@ static int __init tdx_guest_init(void)
>> if (ret)
>> goto deinit_mr;
>>
>> - quote_data = alloc_quote_buf();
>> + quote_data_len = PAGE_ALIGN(GET_QUOTE_BUF_SIZE);
>> + quote_data = alloc_quote_buf(quote_data_len);
> since quote_data_len is a global variable, it looks no need to pass it around.
>
> Same for free_quote_buf()

It's not the end of the world, but... global variable == bad. Plus,
handing global variables around can actually make the code flow more clear.

I'd much rather have a quote_data_len() with a static function variable.
Oh, and, btw... "quote_data_len" is the wrong name. It's literally *not*
"the length of the quote data" itself because it has the header metadata
included in there.