Commit 7df56c25 authored by Roel Kluin's avatar Roel Kluin Committed by Eric Miao

[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: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent 10d5d99e
...@@ -207,7 +207,7 @@ unsigned long mfp_read(int mfp) ...@@ -207,7 +207,7 @@ unsigned long mfp_read(int mfp)
{ {
unsigned long val, flags; unsigned long val, flags;
BUG_ON(mfp >= MFP_PIN_MAX); BUG_ON(mfp < 0 || mfp >= MFP_PIN_MAX);
spin_lock_irqsave(&mfp_spin_lock, flags); spin_lock_irqsave(&mfp_spin_lock, flags);
val = mfpr_readl(mfp_table[mfp].mfpr_off); val = mfpr_readl(mfp_table[mfp].mfpr_off);
...@@ -220,7 +220,7 @@ void mfp_write(int mfp, unsigned long val) ...@@ -220,7 +220,7 @@ void mfp_write(int mfp, unsigned long val)
{ {
unsigned long flags; unsigned long flags;
BUG_ON(mfp >= MFP_PIN_MAX); BUG_ON(mfp < 0 || mfp >= MFP_PIN_MAX);
spin_lock_irqsave(&mfp_spin_lock, flags); spin_lock_irqsave(&mfp_spin_lock, flags);
mfpr_writel(mfp_table[mfp].mfpr_off, val); mfpr_writel(mfp_table[mfp].mfpr_off, val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment