Commit aafa6482 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Tom Rini

spmi: Fix sandbox spmi driver memory corruption

There is off-by-one error in sandbox_emul_gpio that causes
segfault of certain tests.

EMUL_GPIO_REG_END is the address of last valid (emulated) register.
This patch fixed this (by adding one more element to emulated register array).
Signed-off-by: default avatarMateusz Kulikowski <>
Tested-by: default avatarStephen Warren <>
parent eed095da
......@@ -35,7 +35,8 @@ struct sandbox_emul_fake_regs {
struct sandbox_emul_gpio {
struct sandbox_emul_fake_regs r[EMUL_GPIO_REG_END]; /* Fake registers */
/* Fake registers - need one more entry as REG_END is valid address. */
struct sandbox_emul_fake_regs r[EMUL_GPIO_REG_END + 1];
struct sandbox_spmi_priv {
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment