Commit b12eab1a796a306caef7046b21a76efa35f5f489

Authored by Denis Kirjanov
Committed by Robert Richter
1 parent d8a382d266

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

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

arch/powerpc/oprofile/op_model_cell.c
... ... @@ -1077,7 +1077,7 @@
1077 1077 index = ENTRIES-1;
1078 1078  
1079 1079 /* make sure index is valid */
1080   - if ((index > ENTRIES) || (index < 0))
  1080 + if ((index >= ENTRIES) || (index < 0))
1081 1081 index = ENTRIES-1;
1082 1082  
1083 1083 return initial_lfsr[index];