Skip to content

Commit

Permalink
Blackfin arch: add BUG_ON() checks to make sure we dont overflow the …
Browse files Browse the repository at this point in the history
…cplb tables

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
  • Loading branch information
Mike Frysinger authored and Bryan Wu committed Nov 18, 2008
1 parent 8624991 commit dce783c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arch/blackfin/kernel/cplb-nompu/cplbinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit dce783c

Please sign in to comment.