Skip to content

Commit

Permalink
powerpc/oprofile: fix potential buffer overrun in op_model_cell.c
Browse files Browse the repository at this point in the history
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>
Cc: stable@kernel.org
Signed-off-by: Robert Richter <robert.richter@amd.com>
  • Loading branch information
Denis Kirjanov authored and Robert Richter committed Jun 7, 2010
1 parent 58cc1a9 commit 238c1a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/oprofile/op_model_cell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 238c1a7

Please sign in to comment.