xen/common/compat/memory.c:175 if ( order_delta >= 0 ) nat.xchg->out.nr_extents = end_extent >> order_delta; else nat.xchg->out.nr_extents = end_extent << order_delta; Shifting a negative "order_delta" doesn''t make much sense. Should it be something like "end_extent << -order_delta"? Thanks. - xi
>>> On 01.03.13 at 12:30, Xi Wang <xi@mit.edu> wrote: > xen/common/compat/memory.c:175 > > if ( order_delta >= 0 ) > nat.xchg->out.nr_extents = end_extent >> order_delta; > else > nat.xchg->out.nr_extents = end_extent << order_delta; > > Shifting a negative "order_delta" doesn''t make much sense. > > Should it be something like "end_extent << -order_delta"? Thanks.Yes, absolutely. Thanks for pointing this out! Jan
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> --- 2013-02-21.orig/xen/common/compat/memory.c 2013-02-26 17:22:57.000000000 +0100 +++ 2013-02-21/xen/common/compat/memory.c 2013-03-01 13:01:22.000000000 +0100 @@ -173,7 +173,7 @@ int compat_memory_op(unsigned int cmd, X 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; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
On 01/03/2013 12:07, "Jan Beulich" <JBeulich@suse.com> wrote:> 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>> --- 2013-02-21.orig/xen/common/compat/memory.c 2013-02-26 17:22:57.000000000 > +0100 > +++ 2013-02-21/xen/common/compat/memory.c 2013-03-01 13:01:22.000000000 +0100 > @@ -173,7 +173,7 @@ int compat_memory_op(unsigned int cmd, X > 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; > } > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel