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>
此提交包含在:
Roel Kluin
2009-11-02 16:14:42 +00:00
提交者 Paul Mundt
父節點 c4b973f532
當前提交 9016332014
共有 3 個檔案被更改,包括 3 行新增3 行删除

查看文件

@@ -116,7 +116,7 @@ static unsigned char irl2irq[R2D_NR_IRL];
int rts7751r2d_irq_demux(int irq)
{
if (irq >= R2D_NR_IRL || !irl2irq[irq])
if (irq >= R2D_NR_IRL || irq < 0 || !irl2irq[irq])
return irq;
return irl2irq[irq];