diff options
author | Aleksandr Mishin <amishin@t-argos.ru> | 2024-06-06 10:52:04 +0300 |
---|---|---|
committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2024-06-11 11:16:40 -0600 |
commit | 2fa26ca8b786888673689ccc9da6094150939982 (patch) | |
tree | 0a57b3ff61a46634bfa77d7d1e9aad986d847927 /drivers/remoteproc/imx_rproc.c | |
parent | 430e29787fd013500c5907cdf3f7371cc97079ed (diff) | |
download | lwn-2fa26ca8b786888673689ccc9da6094150939982.tar.gz lwn-2fa26ca8b786888673689ccc9da6094150939982.zip |
remoteproc: imx_rproc: Skip over memory region when node value is NULL
In imx_rproc_addr_init() "nph = of_count_phandle_with_args()" just counts
number of phandles. But phandles may be empty. So of_parse_phandle() in
the parsing loop (0 < a < nph) may return NULL which is later dereferenced.
Adjust this issue by adding NULL-return check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240606075204.12354-1-amishin@t-argos.ru
[Fixed title to fit within the prescribed 70-75 charcters]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/remoteproc/imx_rproc.c')
-rw-r--r-- | drivers/remoteproc/imx_rproc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 5a3fb902acc9..39eacd90af14 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -726,6 +726,8 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, struct resource res; node = of_parse_phandle(np, "memory-region", a); + if (!node) + continue; /* Not map vdevbuffer, vdevring region */ if (!strncmp(node->name, "vdev", strlen("vdev"))) { of_node_put(node); |