Title: [5888] trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c: add some BUG_ON() checks to make sure we dont overflow the small cplb_bounds array
Revision
5888
Author
vapier
Date
2008-12-18 11:55:59 -0600 (Thu, 18 Dec 2008)

Log Message

add some BUG_ON() checks to make sure we dont overflow the small cplb_bounds array

Modified Paths

Diff

Modified: trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c (5887 => 5888)


--- trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c	2008-12-18 17:55:35 UTC (rev 5887)
+++ trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c	2008-12-18 17:55:59 UTC (rev 5888)
@@ -113,7 +113,6 @@
 	/* ASYNC banks.  */
 	dcplb_bounds[i_d].eaddr = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE;
 	dcplb_bounds[i_d++].data = ""
-
 	if (L2_LENGTH) {
 		/* Addressing hole up to L2 SRAM.  */
 		dcplb_bounds[i_d].eaddr = L2_START;
@@ -122,9 +121,9 @@
 		dcplb_bounds[i_d].eaddr = L2_START + L2_LENGTH;
 		dcplb_bounds[i_d++].data = ""
 	}
-
 	dcplb_bounds[i_d].eaddr = 0;
 	dcplb_nr_bounds = i_d;
+	BUG_ON(dcplb_nr_bounds >= ARRAY_SIZE(dcplb_bounds));
 
 	i_i = 0;
 	/* Normal RAM, including MTD FS.  */
@@ -155,4 +154,5 @@
 	}
 	icplb_bounds[i_i].eaddr = 0;
 	icplb_nr_bounds = i_i;
+	BUG_ON(icplb_nr_bounds >= ARRAY_SIZE(icplb_bounds));
 }
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to