From 42f8e580bcc2c7585c9ebdaec09c8079bd5fb2ef Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 29 Oct 2012 09:02:33 +0100 Subject: [PATCH] x86/oprof: adjust off-by-one counter range checks Signed-off-by: Jan Beulich Acked-by: Keir Fraser xen-unstable changeset: 26061:4b4c0c7a6031 xen-unstable date: Wed Oct 17 09:23:10 UTC 2012 --- xen/arch/x86/oprofile/xenoprof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c index b926b19e6d..c00f193c26 100644 --- a/xen/arch/x86/oprofile/xenoprof.c +++ b/xen/arch/x86/oprofile/xenoprof.c @@ -25,7 +25,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; @@ -63,7 +63,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;