drm/panel: fix null pointer dereference in hx83102_get_modes
Subsystems (3)
PATCH v2 1/1 drm/panel: fix null pointer dereference in hx83102_get_modes
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.
--- drivers/gpu/drm/panel/panel-himax-hx83102.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/panel/panel-himax-hx83102.c +0 -1
@@ -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 ; }
Signature · 1 line
2.31.1
Hi,
Quoted 17 lines · Charles Han <[email protected]> 于2024年8月23日周五 16:37写道:
In
hx83102_get_modes(), the return value ofdrm_mode_duplicate()is assigned to mode, which will lead to a possible NULL pointer dereference on failure ofdrm_mode_duplicate(). Add a check to avoid npd.Fixes 0ef94554dc40 ("drm/panel: himax-hx83102: Break out as separate driver")Signed-off-by Charles Han <[email protected]>--- drivers/gpu/drm/panel/panel-himax-hx83102.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/panel/panel-himax-hx83102.c +0
-0
drivers/gpu/drm/panel/panel-himax-hx83102.c static int hx83102_get_modes(struct drm_panel *panel, · line 569
Quoted 4 lines
drivers/gpu/drm/panel/panel-himax-hx83102.c +0
-1@@ -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" );
Your V2 patch should not depend V1, should make patches on the base code.
And when you send the next release, explain the differences from the previous submission in a cover letter or a single patch.
see https://www.kernel.org/doc/html/latest/process/submitting-patches.html#respond-to-review-comments
In addition, Doug made some comments in V1, you should CC him when sending patches.
drivers/gpu/drm/panel/panel-himax-hx83102.c static int hx83102_get_modes(struct drm_panel *panel, · line 570
Quoted 2 lines
drivers/gpu/drm/panel/panel-himax-hx83102.c +0
-0return -EINVAL ; }
nit: remove brackets
Quoted 4 lines
drivers/gpu/drm/panel/panel-himax-hx83102.c +0
-1--2.31.1