From: tip-bot for Dan Carpenter <dan.carpenter@oracle.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, hpa@zytor.com,
mingo@kernel.org, a.p.zijlstra@chello.nl, jolsa@redhat.com,
fweisbec@gmail.com, tglx@linutronix.de, dan.carpenter@oracle.com
Subject: [tip:perf/core] perf: Fix off by one test in perf_reg_value()
Date: Wed, 19 Sep 2012 10:04:07 -0700 [thread overview]
Message-ID: <tip-1e6dd8adc78d4a153db253d051fd4ef6c49c9019@git.kernel.org> (raw)
In-Reply-To: <20120905123126.GC6128@elgon.mountain>
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]);
parent reply other threads:[~2012-09-19 17:04 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20120905123126.GC6128@elgon.mountain>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-1e6dd8adc78d4a153db253d051fd4ef6c49c9019@git.kernel.org \
--to=dan.carpenter@oracle.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome