Re: [PATCH v3 07/25] x86/sgx: Initialize virtual EPC driver even when SGX driver is disabled

Borislav Petkov
2021-04-02T19:46:52Z

On Fri, Apr 02, 2021 at 07:30:23PM +0000, Sean Christopherson wrote:
> Heh, that's what I had originally and used for literally years. IIRC, I
> suggested the "!! & !!" abomination after internal review complained about the
> oddness of the above.

Whut?

> FWIW, I think the above is far less likely to be misread, even though I love the
> cleverness of the bitwise AND.

The problem with using bitwise operations here is that they don't belong
in a logical expression of this sort - you do those when you actually
work with bitmasks etc and not when you wanna check whether the functions
returned success or not.

Yeah, yeah, the bitwise thing gets you what you want and yadda yadda but
readability is important. That thing that keeps this code maintainable
years from now...

Also, your original suggestion is literally translating the comment in
code, while

!!sgx_drv_init() & !!sgx_vepc_init()

especially with that bitwise-& in there, makes me go "say what now?!"

So yeah, you were right the first time.

:-)

--
Regards/Gruss,
Boris.