Skip to content

Commit 2fa26ca

Browse files
Aleksandr Mishinmathieupoirier
authored andcommitted
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: a0ff4aa ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver") Signed-off-by: Aleksandr Mishin <[email protected]> Reviewed-by: Peng Fan <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] [Fixed title to fit within the prescribed 70-75 charcters] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 430e297 commit 2fa26ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/remoteproc/imx_rproc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
726726
struct resource res;
727727

728728
node = of_parse_phandle(np, "memory-region", a);
729+
if (!node)
730+
continue;
729731
/* Not map vdevbuffer, vdevring region */
730732
if (!strncmp(node->name, "vdev", strlen("vdev"))) {
731733
of_node_put(node);

0 commit comments

Comments
 (0)