]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc/oprofile: fix potential buffer overrun in op_model_cell.c
authorDenis Kirjanov <dkirjanov@hera.kernel.org>
Tue, 1 Jun 2010 19:43:34 +0000 (15:43 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:08:43 +0000 (11:08 -0700)
commit 238c1a78c957f3dc7cb848b161dcf4805793ed56 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>
arch/powerpc/oprofile/op_model_cell.c

index 5ff4de3eb3be335ccdad62f4c208415c25a4bf88..303721d708696d4818355efaadc770674512d254 100644 (file)
@@ -821,7 +821,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];