Re: [PATCH v3 03/16] x86/virt/tdx: Simplify tdmr_get_pamt_sz()

Edgecombe, Rick P
2025-09-19T19:26:24Z

On Fri, 2025-09-19 at 00:50 +0000, Huang, Kai wrote:
> > +   nid, &node_online_map);
> > + if (!pamt) {
> > + /* Zero base so that the error path will skip freeing. */
> > + tdmr->pamt_4k_base = 0;
> >    return -ENOMEM;
>
> Do you need to zero the base here?  IIUC, it hasn't been setup yet if PAMT
> allocation fails.  All TDMRs are allocated with __GFP_ZERO, so it should
> be 0 already when PAMT allocation fails here.

Oh, you are right. It's zero allocated. Hmm a comment should probably go
somewhere still.