Skip to contentSkip to conversation

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

PATCH In review Denis Kirjanov 3 participants 3 messages Jun 1, 2010 – Jun 4, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 arch/powerpc/oprofile/op_model_cell.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/oprofile/op_model_cell.c +1 -1
index 2c9e522..7fd90d0 100644
@@ -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];
#1 lore raw

Denis:

I have reviewed the change and agree to it. Thanks for catching that.

Carl Love

Denis Kirjanov
<[email protected]
ernel.org> To
[email protected],
06/01/2010 12:43 [email protected],
PM [email protected], [email protected]
cc
[email protected], [email protected]
Subject
[PATCH] 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

---
 arch/powerpc/oprofile/op_model_cell.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/oprofile/op_model_cell.c
index 2c9e522..7fd90d0 100644

arch/powerpc/oprofile/op_model_cell.c +1 -1
@@ -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];

------------------------------------------------------------------------------

_______________________________________________
oprofile-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oprofile-list