Re: [GIT PULL] KVM fixes for Linux 5.15-rc7

From: Paolo Bonzini
Date: Mon Oct 18 2021 - 14:03:37 EST


On 18/10/21 19:57, Linus Torvalds wrote:
The way to do a logical "or" (instead of a bitwise one on two boolean
expressions) is to use "||".

Instead, the code was changed to completely insane

(int) boolexpr1 | (int) boolexpr2

thing, which is entirely illegible and pointless, and no sane person
should ever write code like that.

In other words, the*proper* fix to a warning is to look at the code,
and*unsderstand* the code and the warning, instead of some mindless
conversion to just avoid a warning.

The code is not wrong, there is a comment explaining it:

* Use a bitwise-OR instead of a logical-OR to aggregate the reserved
* bits and EPT's invalid memtype/XWR checks to avoid an extra Jcc
* (this is extremely unlikely to be short-circuited as true).

Paolo