[2/2] drm/imx: Fix error handling for a kmemdup() call in imx_ldb_panel_ddc()
diff mbox series

Message ID d35e4483-e310-c5b8-467e-a6a51f49dfef@web.de
State New
Headers show
Series
  • [1/2] drm/imx: Fix error handling for a kmemdup() call in imx_pd_bind()
Related show

Commit Message

Markus Elfring Oct. 12, 2019, 9:10 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 12 Oct 2019 10:33:47 +0200

The return value from a call of the function “kmemdup” was not checked
in this function implementation. Thus add the corresponding error handling.

This issue was detected by using the Coccinelle software.

Fixes: dc80d7038883feca2abd08975165bc0d83c84762 ("drm/imx-ldb: Add support to drm-bridge")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/imx/imx-ldb.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.23.0

Patch
diff mbox series

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 208069faf183..801a2265dd11 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -569,6 +569,8 @@  static int imx_ldb_panel_ddc(struct device *dev,
 			channel->edid = kmemdup(edidp,
 						channel->edid_len,
 						GFP_KERNEL);
+			if (!channel->edid)
+				return -ENOMEM;
 		} else if (!channel->panel) {
 			/* fallback to display-timings node */
 			ret = of_get_drm_display_mode(child,