]> git.itanic.dy.fi Git - linux-stable/commit
KVM: x86: fix shift out of bounds reported by UBSAN
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Dec 2020 10:20:43 +0000 (05:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jan 2021 19:10:24 +0000 (20:10 +0100)
commit1412cdde820467d212515798366c9cc242dc1c59
tree2253e5866df7aeb33fd4b715e2a30577e9c83b92
parent4dd18f7893df7d7d2eb50b27bea96e6076a51d67
KVM: x86: fix shift out of bounds reported by UBSAN

commit 2f80d502d627f30257ba7e3655e71c373b7d1a5a upstream.

Since we know that e >= s, we can reassociate the left shift,
changing the shifted number from 1 to 2 in exchange for
decreasing the right hand side by 1.

Reported-by: syzbot+e87846c48bf72bc85311@syzkaller.appspotmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/mmu.h