Re: [PATCH v7 11/20] x86/virt/tdx: Add placeholder to construct TDMRs to cover all TDX memory regions

From: Dave Hansen
Date: Mon Nov 28 2022 - 10:59:09 EST


On 11/24/22 04:02, Huang, Kai wrote:
> On Wed, 2022-11-23 at 14:17 -0800, Dave Hansen wrote:
>> First, I think 'tdx_sysinfo' should probably be a local variable in
>> init_tdx_module() and have its address passed in here. Having global
>> variables always makes it more opaque about who is initializing it.
> Sorry I missed to respond this.
>
> Using local variable for 'tdx_sysinfo' will cause a build warning:
>
> https://lore.kernel.org/lkml/a6694c81b4e96a22557fd0af70a81bd2c2e4e3e7.camel@xxxxxxxxx/

Having it be local scope is a lot more important than having it be on
stack. Just declare it local to the function but keep it off the stack.
No need to dynamically allocate it, even.