From: Jan Beulich Date: Wed, 17 Oct 2012 09:23:10 +0000 (+0200) Subject: x86/oprof: adjust off-by-one counter range checks X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7743 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b6f2a5303932b0877706feb3221028dbed95b001;p=xen.git x86/oprof: adjust off-by-one counter range checks Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c index 69476f2659..a10d3597e8 100644 --- a/xen/arch/x86/oprofile/xenoprof.c +++ b/xen/arch/x86/oprofile/xenoprof.c @@ -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;