x86/oprof: adjust off-by-one counter range checks
authorJan Beulich <jbeulich@suse.com>
Wed, 17 Oct 2012 09:23:10 +0000 (11:23 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 17 Oct 2012 09:23:10 +0000 (11:23 +0200)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/oprofile/xenoprof.c

index 69476f265981da61e44d7cfb85aebe8b82537864..a10d3597e864e80e1607c85645298fb33be07271 100644 (file)
@@ -24,7 +24,7 @@ int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
     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_HANDLE(void) arg)
     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;