Re: [PATCH v8 06/11] x86/traps: Add #VE support for TDX guest

From: Borislav Petkov
Date: Mon Oct 18 2021 - 06:53:46 EST


On Sun, Oct 17, 2021 at 10:15:22AM -0700, Dave Hansen wrote:
> I think it's equivalent to something like a 'pt_regs' or 'stack_info'
> that we pass around in other exception handlers. It's always stack
> allocated. It's never dynamically allocated and NULL is never passed
> for some other semantic reason.

Ok, but why is adding that check such a big deal?

Are you saying that nothing else will call tdx_get_ve_info() in the
future so we should trust the passed in *ve pointer blindly or should we
simply add that cheap check just in case.

I don't mind having it without it but wondering why a little defensive
programming is a problem, at all.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette