public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Denis Kirjanov <dkirjanov@hera•kernel.org>
To: arnd@arndb•de, benh@kernel•crashing.org, paulus@samba•org,
	jkosina@suse•cz
Cc: robert.richter@amd•com, linuxppc-dev@ozlabs•org,
	oprofile-list@lists•sf.net, cel@us•ibm.com
Subject: [PATCH] powerpc/oprofile: fix potential buffer overrun in op_model_cell.c
Date: Tue, 1 Jun 2010 19:43:34 +0000	[thread overview]
Message-ID: <20100601194334.GA4549@hera.kernel.org> (raw)

Fix potential initial_lfsr buffer overrun.
Writing past the end of the buffer could happen when index == ENTRIES

Signed-off-by: Denis Kirjanov <dkirjanov@kernel•org>
---
 arch/powerpc/oprofile/op_model_cell.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index 2c9e522..7fd90d0 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -1077,7 +1077,7 @@ static int calculate_lfsr(int n)
 		index = ENTRIES-1;
 
 	/* make sure index is valid */
-	if ((index > ENTRIES) || (index < 0))
+	if ((index >= ENTRIES) || (index < 0))
 		index = ENTRIES-1;
 
 	return initial_lfsr[index];

             reply	other threads:[~2010-06-01 19:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 19:43 Denis Kirjanov [this message]
2010-06-02 20:12 ` [PATCH] powerpc/oprofile: fix potential buffer overrun in op_model_cell.c Carl Love
2010-06-04  9:58 ` Robert Richter

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=20100601194334.GA4549@hera.kernel.org \
    --to=dkirjanov@hera$(echo .)kernel.org \
    --cc=arnd@arndb$(echo .)de \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=cel@us$(echo .)ibm.com \
    --cc=jkosina@suse$(echo .)cz \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=oprofile-list@lists$(echo .)sf.net \
    --cc=paulus@samba$(echo .)org \
    --cc=robert.richter@amd$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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