diff options
author | Mateusz Kulikowski <mateusz.kulikowski@gmail.com> | 2016-04-04 19:55:58 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-04-11 20:48:22 -0400 |
commit | aafa64827f30a7d2aa2c2cc2a60906eabd0272b8 (patch) | |
tree | 8a4b72727ea48a370be8a63bdc1e11c6506450d4 /drivers/spmi | |
parent | eed095da30bb6f464c24db81fb6406f7ba1cc16b (diff) | |
download | u-boot-imx-aafa64827f30a7d2aa2c2cc2a60906eabd0272b8.zip u-boot-imx-aafa64827f30a7d2aa2c2cc2a60906eabd0272b8.tar.gz u-boot-imx-aafa64827f30a7d2aa2c2cc2a60906eabd0272b8.tar.bz2 |
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: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/spmi')
-rw-r--r-- | drivers/spmi/spmi-sandbox.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spmi/spmi-sandbox.c b/drivers/spmi/spmi-sandbox.c index 2f0fea0..980aff2 100644 --- a/drivers/spmi/spmi-sandbox.c +++ b/drivers/spmi/spmi-sandbox.c @@ -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 { |