diff --git a/patches.suse/x86-kvm-avoid-constant-conversion-warning.patch b/patches.suse/x86-kvm-avoid-constant-conversion-warning.patch new file mode 100644 index 0000000..32cce23 --- /dev/null +++ b/patches.suse/x86-kvm-avoid-constant-conversion-warning.patch @@ -0,0 +1,53 @@ +Patch-mainline: v5.3-rc1 +Git-commit: a6a6d3b1f867d34ba5bd61aa7bb056b48ca67cff +References: git-fixes +From: Arnd Bergmann +Date: Fri, 12 Jul 2019 11:12:30 +0200 +Subject: [PATCH] x86: kvm: avoid constant-conversion warning + +clang finds a contruct suspicious that converts an unsigned +character to a signed integer and back, causing an overflow: + +arch/x86/kvm/mmu.c:4605:39: error: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from -205 to 51 [-Werror,-Wconstant-conversion] + u8 wf = (pfec & PFERR_WRITE_MASK) ? ~w : 0; + ~~ ^~ +arch/x86/kvm/mmu.c:4607:38: error: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from -241 to 15 [-Werror,-Wconstant-conversion] + u8 uf = (pfec & PFERR_USER_MASK) ? ~u : 0; + ~~ ^~ +arch/x86/kvm/mmu.c:4609:39: error: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from -171 to 85 [-Werror,-Wconstant-conversion] + u8 ff = (pfec & PFERR_FETCH_MASK) ? ~x : 0; + ~~ ^~ + +Add an explicit cast to tell clang that everything works as +intended here. + +Signed-off-by: Arnd Bergmann +Link: https://github.com/ClangBuiltLinux/linux/issues/95 +Signed-off-by: Paolo Bonzini +Signed-off-by: Juergen Gross +--- + arch/x86/kvm/mmu.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c +index 9a5814d8d194..8f72526e2f68 100644 +--- a/arch/x86/kvm/mmu.c ++++ b/arch/x86/kvm/mmu.c +@@ -4597,11 +4597,11 @@ static void update_permission_bitmask(struct kvm_vcpu *vcpu, + */ + + /* Faults from writes to non-writable pages */ +- u8 wf = (pfec & PFERR_WRITE_MASK) ? ~w : 0; ++ u8 wf = (pfec & PFERR_WRITE_MASK) ? (u8)~w : 0; + /* Faults from user mode accesses to supervisor pages */ +- u8 uf = (pfec & PFERR_USER_MASK) ? ~u : 0; ++ u8 uf = (pfec & PFERR_USER_MASK) ? (u8)~u : 0; + /* Faults from fetches of non-executable pages*/ +- u8 ff = (pfec & PFERR_FETCH_MASK) ? ~x : 0; ++ u8 ff = (pfec & PFERR_FETCH_MASK) ? (u8)~x : 0; + /* Faults from kernel mode fetches of user pages */ + u8 smepf = 0; + /* Faults from kernel mode accesses of user pages */ +-- +2.35.3 + diff --git a/series.conf b/series.conf index b8ae272..00a24f1 100644 --- a/series.conf +++ b/series.conf @@ -51825,6 +51825,7 @@ patches.suse/scsi-libfc-fix-null-pointer-dereference-on-a-null-lport patches.suse/scsi-sd_zbc-Fix-compilation-warning.patch patches.suse/scsi-core-fix-race-on-creating-sense-cache + patches.suse/x86-kvm-avoid-constant-conversion-warning.patch patches.suse/kvm-svm-fix-detection-of-amd-errata-1096 patches.suse/kvm-x86-vpmu-refine-kvm_pmu-err-msg-when-event-creation-failed patches.suse/kvm-nvmx-do-not-use-dangling-shadow-vmcs-after-guest-reset