summaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/cplb-nompu
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2008-11-18 10:48:21 +0100
committerBryan Wu <cooloney@kernel.org>2008-11-18 10:48:21 +0100
commitdce783c5e400d6a470c86ccb5a7fdeabf27afbf4 (patch)
treea33bd6aa60514620856b473ece56af91190c4015 /arch/blackfin/kernel/cplb-nompu
parentBlackfin arch: make ROM_BASE depend on ROMKERNEL (diff)
downloadlinux-dce783c5e400d6a470c86ccb5a7fdeabf27afbf4.tar.xz
linux-dce783c5e400d6a470c86ccb5a7fdeabf27afbf4.zip
Blackfin arch: add BUG_ON() checks to make sure we dont overflow the cplb tables
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel/cplb-nompu')
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index afef5c740aa4..e14c37e98ed5 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -420,8 +420,17 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
}
}
- /* close tables */
+ /* make sure we locked the kernel start */
+ BUG_ON(cplb.init_i.pos < 2 + cplb_data[ZERO_P].valid);
+ BUG_ON(cplb.init_d.pos < 1 + cplb_data[ZERO_P].valid + cplb_data[L1D_MEM].valid);
+
+ /* make sure we didnt overflow the table */
+ BUG_ON(cplb.init_i.size <= cplb.init_i.pos);
+ BUG_ON(cplb.init_d.size <= cplb.init_d.pos);
+ BUG_ON(cplb.switch_i.size <= cplb.switch_i.pos);
+ BUG_ON(cplb.switch_d.size <= cplb.switch_d.pos);
+ /* close tables */
close_cplbtab(&cplb.init_i);
close_cplbtab(&cplb.init_d);