risc-v/mpfs: i2c: prevent out of bounds read access
priv->msgid may grow past its boundaries, causing struct i2c_msg_s *msg = &priv->msgv[priv->msgid] to read data out of boundaris. Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit is contained in:
parent
38f8aae3be
commit
b0cef9e008
|
@ -493,7 +493,10 @@ static int mpfs_i2c_irq(int cpuint, void *context, void *arg)
|
|||
|
||||
/* Jump to the next message */
|
||||
|
||||
priv->msgid++;
|
||||
if (priv->msgid < (priv->msgc - 1))
|
||||
{
|
||||
priv->msgid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -512,7 +515,10 @@ static int mpfs_i2c_irq(int cpuint, void *context, void *arg)
|
|||
|
||||
/* Jump to the next message */
|
||||
|
||||
priv->msgid++;
|
||||
if (priv->msgid < (priv->msgc - 1))
|
||||
{
|
||||
priv->msgid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue