KVM: arm64: Add build-time sanity checks for flags
authorMarc Zyngier <maz@kernel.org>
Sat, 28 May 2022 11:38:26 +0000 (12:38 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 29 Jun 2022 09:23:41 +0000 (10:23 +0100)
commit5a3984f4ec73d1c7cf31a4cee46cca7d4c75deee
treeca1c96604c1a69e0d8b42d67c46e1811554e292a
parente19f2c6cd14668c0d5b1cef280632b7ca5893118
KVM: arm64: Add build-time sanity checks for flags

Flags are great, but flags can also be dangerous: it is easy
to encode a flag that is bigger than its container (unless the
container is a u64), and it is easy to construct a flag value
that doesn't fit in the mask that is associated with it.

Add a couple of build-time sanity checks that ensure we catch
these two cases.

Reviewed-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/kvm_host.h