From 2d0410b1eea534f3a3bb3f7c6d4ea0bea8ed66ea Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Wed, 1 Sep 2021 14:24:51 +1000 Subject: [PATCH] vtx: fix EPT cache attribute setting Credits for this one should go to clang-11, which correctly flags that the big `||` always yielded true and was not doing what was intended. This means, previously the only possible cache attribute for EPT was EPTWriteBack. Signed-off-by: Gerwin Klein --- src/arch/x86/kernel/ept.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arch/x86/kernel/ept.c b/src/arch/x86/kernel/ept.c index eb919f0c4..32855c72a 100644 --- a/src/arch/x86/kernel/ept.c +++ b/src/arch/x86/kernel/ept.c @@ -182,9 +182,9 @@ static ept_cache_options_t eptCacheFromVmAttr(vm_attributes_t vmAttr) /* PAT cache options are 1-1 with ept_cache_options. But need to verify user has specified a sensible option */ ept_cache_options_t option = vmAttr.words[0]; - if (option != EPTUncacheable || - option != EPTWriteCombining || - option != EPTWriteThrough || + if (option != EPTUncacheable && + option != EPTWriteCombining && + option != EPTWriteThrough && option != EPTWriteBack) { /* No failure mode is supported here, vmAttr settings should be verified earlier */ option = EPTWriteBack;