aboutsummaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2008-09-09 23:02:43 +0200
committerPaul Mundt <lethal@linux-sh.org>2008-09-10 12:01:46 +0900
commitb21a91043592434e2847c4b552be7b51851d92c3 (patch)
tree610ca37711d0888adcc65d34fc6cd0236050dca1 /arch/sh
parent6eb2139b3dc3e1c5181a7cdf83a517c57c34bb12 (diff)
sh: intc_prio_data() test before subtraction on unsigned
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>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/cpu/irq/intc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/sh/kernel/cpu/irq/intc.c b/arch/sh/kernel/cpu/irq/intc.c
index 8c70e201bde..94536d358fe 100644
--- a/arch/sh/kernel/cpu/irq/intc.c
+++ b/arch/sh/kernel/cpu/irq/intc.c
@@ -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),
@@ -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);