Patchwork powerpc/fsl-booke: Read buffer overflow

login
register
mail settings
Submitter roel kluin
Date July 31, 2009, 12:38 p.m.
Message ID <4A72E5CA.7070602@gmail.com>
Download mbox | patch
Permalink /patch/30427/
State Accepted, archived
Commit 8dcd038a13b8e322c49fe0d3e31a0deaba4fd5fd
Delegated to: Kumar Gala
Headers show

Comments

roel kluin - July 31, 2009, 12:38 p.m.
cam[tlbcam_index] is checked before tlbcam_index < ARRAY_SIZE(cam)

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---

Patch

diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index bb3d659..dc93e95 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -161,7 +161,7 @@  unsigned long __init mmu_mapin_ram(void)
 	unsigned long virt = PAGE_OFFSET;
 	phys_addr_t phys = memstart_addr;
 
-	while (cam[tlbcam_index] && tlbcam_index < ARRAY_SIZE(cam)) {
+	while (tlbcam_index < ARRAY_SIZE(cam) && cam[tlbcam_index]) {
 		settlbcam(tlbcam_index, virt, phys, cam[tlbcam_index], PAGE_KERNEL_X, 0);
 		virt += cam[tlbcam_index];
 		phys += cam[tlbcam_index];