linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip:perf/core] perf: Fix off by one test in perf_reg_value()
       [not found] <20120905123126.GC6128@elgon.mountain>
@ 2012-09-19 17:04 ` tip-bot for Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: tip-bot for Dan Carpenter @ 2012-09-19 17:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, a.p.zijlstra, jolsa, fweisbec,
	tglx, dan.carpenter

Commit-ID:  1e6dd8adc78d4a153db253d051fd4ef6c49c9019
Gitweb:     http://git.kernel.org/tip/1e6dd8adc78d4a153db253d051fd4ef6c49c9019
Author:     Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Wed, 5 Sep 2012 15:31:26 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Sep 2012 17:08:40 +0200

perf: Fix off by one test in perf_reg_value()

The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/r/20120905123126.GC6128@elgon.mountain
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/perf_regs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c
index c5a3e5c..e309cc5 100644
--- a/arch/x86/kernel/perf_regs.c
+++ b/arch/x86/kernel/perf_regs.c
@@ -57,7 +57,7 @@ static unsigned int pt_regs_offset[PERF_REG_X86_MAX] = {
 
 u64 perf_reg_value(struct pt_regs *regs, int idx)
 {
-	if (WARN_ON_ONCE(idx > ARRAY_SIZE(pt_regs_offset)))
+	if (WARN_ON_ONCE(idx >= ARRAY_SIZE(pt_regs_offset)))
 		return 0;
 
 	return regs_get_register(regs, pt_regs_offset[idx]);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-19 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20120905123126.GC6128@elgon.mountain>
2012-09-19 17:04 ` [tip:perf/core] perf: Fix off by one test in perf_reg_value() tip-bot for Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).