]> xenbits.xensource.com Git - xen.git/commit
x86emul: replace UB shifts
authorJan Beulich <jbeulich@suse.com>
Fri, 31 Jul 2020 15:41:58 +0000 (17:41 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 31 Jul 2020 15:41:58 +0000 (17:41 +0200)
commitb6a907f8c83d37886d0523f1aeff61b98e133498
tree4a2ae090b6a89fc7fd477ae36be549c93a78ded4
parent132ece59bfae2864f8888e489563bf09cd92fa44
x86emul: replace UB shifts

Displacement values can be negative, hence we shouldn't left-shift them.
Or else we get

(XEN) UBSAN: Undefined behaviour in x86_emulate/x86_emulate.c:3482:55
(XEN) left shift of negative value -2

While auditing shifts, I noticed a pair of missing parentheses, which
also get added right here.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c