[PATCH v2 1/1] drm/panel: fix null pointer dereference in hx83102_get_modes
Charles Han
hanchunchao at inspur.com
Fri Aug 23 08:36:57 UTC 2024
In hx83102_get_modes(), the return value of drm_mode_duplicate() is
assigned to mode, which will lead to a possible NULL pointer
dereference on failure of drm_mode_duplicate(). Add a check to avoid
npd.
Fixes: 0ef94554dc40 ("drm/panel: himax-hx83102: Break out as separate driver")
Signed-off-by: Charles Han <hanchunchao at inspur.com>
---
drivers/gpu/drm/panel/panel-himax-hx83102.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
index 7c2a5e9b7fb3..e61ed7d02729 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
@@ -566,7 +566,6 @@ static int hx83102_get_modes(struct drm_panel *panel,
mode = drm_mode_duplicate(connector->dev, m);
if (!mode) {
- dev_err(&ctx->dsi->dev, "bad mode or failed to add mode\n");
return -EINVAL;
}
--
2.31.1
More information about the dri-devel
mailing list