File 26061-x86-oprof-counter-range.patch of Package xen.openSUSE_12.1_Update

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1350465790 -7200
# Node ID 4b4c0c7a6031820ab521fdd6764cb0df157f44bf
# Parent  4fc87c2f31a02c770655518c9e4d389302564f00
x86/oprof: adjust off-by-one counter range checks

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
@@ -25,7 +25,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;
@@ -63,7 +63,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;
openSUSE Build Service is sponsored by