diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-11-02 11:14:42 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-11-03 21:48:07 -0500 |
commit | 9016332014404ae1dca7198f93804ac67ba9e918 (patch) | |
tree | 5823e797deb138ba18d1c441910d9781a8b7e561 /arch/sh | |
parent | c4b973f532206e1a67b1beae654b44c8be26fc44 (diff) |
sh: Make sure indexes are positive
The indexes are signed, make sure they are not negative
when we read array elements.
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/boards/mach-highlander/setup.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-r2d/irq.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/numa.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c index 566e69d8d729..f663c14d8885 100644 --- a/arch/sh/boards/mach-highlander/setup.c +++ b/arch/sh/boards/mach-highlander/setup.c | |||
@@ -384,7 +384,7 @@ static unsigned char irl2irq[HL_NR_IRL]; | |||
384 | 384 | ||
385 | static int highlander_irq_demux(int irq) | 385 | static int highlander_irq_demux(int irq) |
386 | { | 386 | { |
387 | if (irq >= HL_NR_IRL || !irl2irq[irq]) | 387 | if (irq >= HL_NR_IRL || irq < 0 || !irl2irq[irq]) |
388 | return irq; | 388 | return irq; |
389 | 389 | ||
390 | return irl2irq[irq]; | 390 | return irl2irq[irq]; |
diff --git a/arch/sh/boards/mach-r2d/irq.c b/arch/sh/boards/mach-r2d/irq.c index c70fecedcac4..78d7b27c80da 100644 --- a/arch/sh/boards/mach-r2d/irq.c +++ b/arch/sh/boards/mach-r2d/irq.c | |||
@@ -116,7 +116,7 @@ static unsigned char irl2irq[R2D_NR_IRL]; | |||
116 | 116 | ||
117 | int rts7751r2d_irq_demux(int irq) | 117 | int rts7751r2d_irq_demux(int irq) |
118 | { | 118 | { |
119 | if (irq >= R2D_NR_IRL || !irl2irq[irq]) | 119 | if (irq >= R2D_NR_IRL || irq < 0 || !irl2irq[irq]) |
120 | return irq; | 120 | return irq; |
121 | 121 | ||
122 | return irl2irq[irq]; | 122 | return irl2irq[irq]; |
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 9b784fdb947c..6c524446c0f6 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c | |||
@@ -60,7 +60,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) | |||
60 | unsigned long bootmem_paddr; | 60 | unsigned long bootmem_paddr; |
61 | 61 | ||
62 | /* Don't allow bogus node assignment */ | 62 | /* Don't allow bogus node assignment */ |
63 | BUG_ON(nid > MAX_NUMNODES || nid == 0); | 63 | BUG_ON(nid > MAX_NUMNODES || nid <= 0); |
64 | 64 | ||
65 | start_pfn = start >> PAGE_SHIFT; | 65 | start_pfn = start >> PAGE_SHIFT; |
66 | end_pfn = end >> PAGE_SHIFT; | 66 | end_pfn = end >> PAGE_SHIFT; |