Skip to content

Commit 8027a9a

Browse files
JiangJiaspH5
authored andcommitted
drm/imx: imx-ldb: Check for null pointer after calling kmemdup
As the possible failure of the allocation, kmemdup() may return NULL pointer. Therefore, it should be better to check the return value of kmemdup() and return error if fails. Fixes: dc80d70 ("drm/imx-ldb: Add support to drm-bridge") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/20220105074729.2363657-1-jiasheng@iscas.ac.cn
1 parent 3123109 commit 8027a9a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpu/drm/imx/imx-ldb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ static int imx_ldb_panel_ddc(struct device *dev,
572572
edidp = of_get_property(child, "edid", &edid_len);
573573
if (edidp) {
574574
channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL);
575+
if (!channel->edid)
576+
return -ENOMEM;
575577
} else if (!channel->panel) {
576578
/* fallback to display-timings node */
577579
ret = of_get_drm_display_mode(child,

0 commit comments

Comments
 (0)