mirror of https://gitee.com/openkylin/linux.git
[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>
This commit is contained in:
parent
10d5d99e88
commit
7df56c2586
|
@ -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)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue