Skip to content

Commit

Permalink
sh: intc_prio_data() test before subtraction on unsigned
Browse files Browse the repository at this point in the history
bit is unsigned, so test before subtraction

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
roel kluin authored and Paul Mundt committed Sep 10, 2008
1 parent 6eb2139 commit b21a910
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/sh/kernel/cpu/irq/intc.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,10 @@ static unsigned int __init intc_prio_data(struct intc_desc *desc,
}

fn += (pr->reg_width >> 3) - 1;
bit = pr->reg_width - ((j + 1) * pr->field_width);

BUG_ON(bit < 0);
BUG_ON((j + 1) * pr->field_width > pr->reg_width);

bit = pr->reg_width - ((j + 1) * pr->field_width);

return _INTC_MK(fn, mode,
intc_get_reg(d, reg_e),
Expand Down Expand Up @@ -531,9 +532,10 @@ static unsigned int __init intc_sense_data(struct intc_desc *desc,

fn = REG_FN_MODIFY_BASE;
fn += (sr->reg_width >> 3) - 1;
bit = sr->reg_width - ((j + 1) * sr->field_width);

BUG_ON(bit < 0);
BUG_ON((j + 1) * sr->field_width > sr->reg_width);

bit = sr->reg_width - ((j + 1) * sr->field_width);

return _INTC_MK(fn, 0, intc_get_reg(d, sr->reg),
0, sr->field_width, bit);
Expand Down

0 comments on commit b21a910

Please sign in to comment.