[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_026E4B04ACDCE341411EF54862F8C6AB1605@qq.com>
Date: Tue, 29 Aug 2023 00:55:01 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: victor.liu@....com
Cc: andrzej.hajda@...el.com, neil.armstrong@...aro.org,
rfoss@...nel.org, Laurent.pinchart@...asonboard.com,
jonas@...boo.se, jernej.skrabec@...il.com, airlied@...il.com,
daniel@...ll.ch, shawnguo@...nel.org, s.hauer@...gutronix.de,
kernel@...gutronix.de, festevam@...il.com, linux-imx@....com,
dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Zhang Shurong <zhang_shurong@...mail.com>
Subject: [PATCH] drm/bridge: imx: fix potential NULL pointer dereference in imx8qxp_ldb_parse_dt_companion()
of_match_device() may fail and returns a NULL pointer.
Fix this by checking the return value of of_match_device().
Fixes: 3818715f62b4 ("drm/bridge: imx: Add LDB support for i.MX8qxp")
Signed-off-by: Zhang Shurong <zhang_shurong@...mail.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
index 7984da9c0a35..d272f35c8eac 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
@@ -488,6 +488,8 @@ static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
* string.
*/
match = of_match_device(dev->driver->of_match_table, dev);
+ if (!match)
+ return -ENODEV;
if (!of_device_is_compatible(companion, match->compatible)) {
DRM_DEV_ERROR(dev, "companion LDB is incompatible\n");
ret = -ENXIO;
--
2.30.2
Powered by blists - more mailing lists