diff options
author | Peng Fan <peng.fan@nxp.com> | 2018-12-15 12:19:49 +0000 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2019-01-09 17:03:45 +0100 |
commit | ecab65e4cdec0ee408ca1ac9d0b06d2793fdae91 (patch) | |
tree | 2303c7514bb18b1aa33da390ab6667788796deca | |
parent | 224f745247045262f9c4ca9e379be1002204e4ea (diff) |
misc: imx: scu: avoid write null pointer
When boot_dev is true, fill boot device. However the original logic is when
boot_dev is false, fill boot device, this will trigger data abort.
Also fix sc_misc_get_control when using pointer val.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r-- | drivers/misc/imx8/scu_api.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index 65080d7544..d9c4d5d784 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -169,7 +169,7 @@ int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl, printf("%s: ctrl:%d resource:%d: res:%d\n", __func__, ctrl, resource, RPC_R8(&msg)); - if (!val) + if (val) *val = RPC_U32(&msg, 0U); return ret; @@ -194,7 +194,7 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev) if (ret) printf("%s: res:%d\n", __func__, RPC_R8(&msg)); - if (!boot_dev) + if (boot_dev) *boot_dev = RPC_U16(&msg, 0U); } |