Skip to content

Commit f563dd9

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: Initialize pointer in mtk_drm_of_ddp_path_build_one()
The struct device_node *next pointer is not initialized, and it is used in an error path in which it may have never been modified by function mtk_drm_of_get_ddp_ep_cid(). Since the error path is relying on that pointer being NULL for the OVL Adaptor and/or invalid component check and since said pointer is being used in prints for %pOF, in the case that it points to a bogus address, the print may cause a KP. To resolve that, initialize the *next pointer to NULL before usage. Fixes: 4c93284 ("drm/mediatek: Implement OF graphs support for display paths") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/dri-devel/[email protected]/ Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: CK Hu <[email protected]> Reviewed-by: Alexandre Mergnat <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 5229081 commit f563dd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ static int mtk_drm_of_ddp_path_build_one(struct device *dev, enum mtk_crtc_path
905905
const unsigned int **out_path,
906906
unsigned int *out_path_len)
907907
{
908-
struct device_node *next, *prev, *vdo = dev->parent->of_node;
908+
struct device_node *next = NULL, *prev, *vdo = dev->parent->of_node;
909909
unsigned int temp_path[DDP_COMPONENT_DRM_ID_MAX] = { 0 };
910910
unsigned int *final_ddp_path;
911911
unsigned short int idx = 0;

0 commit comments

Comments
 (0)