aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-11-13 05:37:34 -0500
committerEric Miao <eric.y.miao@gmail.com>2009-11-16 11:50:10 -0500
commit7df56c2586049a06b007474ca059779c81ddb1ff (patch)
tree3853675bae18a130b5ed98d084c38c730663c6cd
parent10d5d99e880692a31ddc59b9f5d063e928fc0c89 (diff)
[ARM] pxa: ensure mfp is in correct range in mfp_{read,write}
Ensure we do not read/write outside array boundaries with a negative index. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r--arch/arm/plat-pxa/mfp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/plat-pxa/mfp.c b/arch/arm/plat-pxa/mfp.c
index 9405d0379c85..be58f9fe65b0 100644
--- a/arch/arm/plat-pxa/mfp.c
+++ b/arch/arm/plat-pxa/mfp.c
@@ -207,7 +207,7 @@ unsigned long mfp_read(int mfp)
207{ 207{
208 unsigned long val, flags; 208 unsigned long val, flags;
209 209
210 BUG_ON(mfp >= MFP_PIN_MAX); 210 BUG_ON(mfp < 0 || mfp >= MFP_PIN_MAX);
211 211
212 spin_lock_irqsave(&mfp_spin_lock, flags); 212 spin_lock_irqsave(&mfp_spin_lock, flags);
213 val = mfpr_readl(mfp_table[mfp].mfpr_off); 213 val = mfpr_readl(mfp_table[mfp].mfpr_off);
@@ -220,7 +220,7 @@ void mfp_write(int mfp, unsigned long val)
220{ 220{
221 unsigned long flags; 221 unsigned long flags;
222 222
223 BUG_ON(mfp >= MFP_PIN_MAX); 223 BUG_ON(mfp < 0 || mfp >= MFP_PIN_MAX);
224 224
225 spin_lock_irqsave(&mfp_spin_lock, flags); 225 spin_lock_irqsave(&mfp_spin_lock, flags);
226 mfpr_writel(mfp_table[mfp].mfpr_off, val); 226 mfpr_writel(mfp_table[mfp].mfpr_off, val);