powerpc/oprofile: fix potential buffer overrun in op_model_cell.c

commit 238c1a78c9 upstream.

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>
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Denis Kirjanov
2010-06-01 15:43:34 -04:00
committed by Greg Kroah-Hartman
parent b8504b8d34
commit e0d3a4aeaf

View File

@@ -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];