]> xenbits.xensource.com Git - people/jgross/xen.git/commitdiff
x86emul: replace further UB shifts
authorJan Beulich <jbeulich@suse.com>
Wed, 5 Aug 2020 08:19:29 +0000 (10:19 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 5 Aug 2020 08:19:29 +0000 (10:19 +0200)
I have no explanation how I managed to overlook these while putting
together what is now b6a907f8c83d ("x86emul: replace UB shifts").

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

index b8a4a1ca82a96632dfc361469f6fb5138571f1e5..10b20cf23bcf125b9c1f4ad48bae627f7993b99e 100644 (file)
@@ -9735,7 +9735,7 @@ x86_emulate(
 
                 rc = ops->read(ea.mem.seg,
                                truncate_ea(ea.mem.off +
-                                           (idx << state->sib_scale)),
+                                           idx * (1 << state->sib_scale)),
                                (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
                 if ( rc != X86EMUL_OKAY )
                 {
@@ -9857,7 +9857,8 @@ x86_emulate(
                 continue;
 
             rc = ops->read(ea.mem.seg,
-                           truncate_ea(ea.mem.off + (idx << state->sib_scale)),
+                           truncate_ea(ea.mem.off +
+                                       idx * (1 << state->sib_scale)),
                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {