spmi: Fix sandbox spmi driver memory corruption
PATCH 1/1 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).
---
drivers/spmi/spmi-sandbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spmi/spmi-sandbox.c +2 -1
@@ -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 {
Signature · 1 line
2.5.0
PATCH 1/1 spmi: Fix sandbox spmi driver memory corruption
Quoted 5 lines · Mateusz Kulikowski
There is off-by-one error in
sandbox_emul_gpiothat causes segfault of certain tests.
EMUL_GPIO_REG_ENDis the address of last valid (emulated) register. This patch fixed this (by adding one more element to emulated register array).
Quoted 8 lines · Mateusz Kulikowski
There is off-by-one error in
sandbox_emul_gpiothat causes segfault of certain tests.
EMUL_GPIO_REG_ENDis 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 <[email protected]>Tested-by Stephen Warren <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160411/550561e8/attachment.sig>