]> xenbits.xensource.com Git - xen.git/commitdiff
fix compat memory exchange op splitting
authorJan Beulich <jbeulich@suse.com>
Fri, 1 Mar 2013 15:59:49 +0000 (16:59 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 1 Mar 2013 15:59:49 +0000 (16:59 +0100)
A shift with a negative count was erroneously used here, yielding
undefined behavior.

Reported-by: Xi Wang <xi@mit.edu>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/compat/memory.c

index e0fc20524cd0bc8eda25382d863c50417a7860b5..caa24ccbe6a7ee6af32b888adcb88872c1e2c6fa 100644 (file)
@@ -172,7 +172,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                 if ( order_delta >= 0 )
                     nat.xchg->out.nr_extents = end_extent >> order_delta;
                 else
-                    nat.xchg->out.nr_extents = end_extent << order_delta;
+                    nat.xchg->out.nr_extents = end_extent << -order_delta;
                 ++split;
             }