RE: [RFC PATCH v5 03/26] x86/sgx: Wipe out EREMOVE from sgx_free_epc_page()

Huang, Kai
2021-02-16T20:43:33Z

> > +/*
> > + * Place the page in uninitialized state. Only usable by callers
> > +that
> > + * know the page is in a clean state in which EREMOVE will succeed.
> > + */
> > +static void sgx_reset_epc_page(struct sgx_epc_page *epc_page) {
> > + int ret;
> > +
> > + WARN_ON_ONCE(epc_page->flags &
> SGX_EPC_PAGE_RECLAIMER_TRACKED);
> > +
> > + ret = __eremove(sgx_get_epc_virt_addr(epc_page));
> > + if (WARN_ONCE(ret, "EREMOVE returned %d (0x%x)", ret, ret))
> > + return;
> > +}
>
> Shouldn't this just be:
>
> ...
> ret = __eremove(sgx_get_epc_virt_addr(epc_page));
> WARN_ONCE(ret, "EREMOVE returned %d (0x%x)", ret, ret); }
>
> Sometimes, you actually need to look at the code that you cut and paste. ;)

Correct! Thanks for catching. I'll remove this useless 'return' in next version.