Jan Beulich
2012-Oct-17  08:34 UTC
[PATCH] x86/oprof: adjust off-by-one counter range checks
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -24,7 +24,7 @@ int xenoprof_arch_counter(XEN_GUEST_HAND
     if ( copy_from_guest(&counter, arg, 1) )
         return -EFAULT;
 
-    if ( counter.ind > OP_MAX_COUNTER )
+    if ( counter.ind >= OP_MAX_COUNTER )
         return -E2BIG;
 
     counter_config[counter.ind].count     = counter.count;
@@ -61,7 +61,7 @@ int compat_oprof_arch_counter(XEN_GUEST_
     if ( copy_from_guest(&counter, arg, 1) )
         return -EFAULT;
 
-    if ( counter.ind > OP_MAX_COUNTER )
+    if ( counter.ind >= OP_MAX_COUNTER )
         return -E2BIG;
 
     counter_config[counter.ind].count     = counter.count;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
Keir Fraser
2012-Oct-17  09:02 UTC
Re: [PATCH] x86/oprof: adjust off-by-one counter range checks
On 17/10/2012 09:34, "Jan Beulich" <JBeulich@suse.com> wrote:> Signed-off-by: Jan Beulich <jbeulich@suse.com>Acked-by: Keir Fraser <keir@xen.org>> --- a/xen/arch/x86/oprofile/xenoprof.c > +++ b/xen/arch/x86/oprofile/xenoprof.c > @@ -24,7 +24,7 @@ int xenoprof_arch_counter(XEN_GUEST_HAND > if ( copy_from_guest(&counter, arg, 1) ) > return -EFAULT; > > - if ( counter.ind > OP_MAX_COUNTER ) > + if ( counter.ind >= OP_MAX_COUNTER ) > return -E2BIG; > > counter_config[counter.ind].count = counter.count; > @@ -61,7 +61,7 @@ int compat_oprof_arch_counter(XEN_GUEST_ > if ( copy_from_guest(&counter, arg, 1) ) > return -EFAULT; > > - if ( counter.ind > OP_MAX_COUNTER ) > + if ( counter.ind >= OP_MAX_COUNTER ) > return -E2BIG; > > counter_config[counter.ind].count = counter.count; > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel