Skip to content

Commit e1e1af9

Browse files
Zhang Zekunsuperna9999
authored andcommitted
drm/panel: himax-hx83102: Add a check to prevent NULL pointer dereference
drm_mode_duplicate() could return NULL due to lack of memory, which will then call NULL pointer dereference. Add a check to prevent it. Fixes: 0ef9455 ("drm/panel: himax-hx83102: Break out as separate driver") Signed-off-by: Zhang Zekun <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Neil Armstrong <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0cff90d commit e1e1af9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpu/drm/panel/panel-himax-hx83102.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ static int hx83102_get_modes(struct drm_panel *panel,
565565
struct drm_display_mode *mode;
566566

567567
mode = drm_mode_duplicate(connector->dev, m);
568+
if (!mode)
569+
return -ENOMEM;
568570

569571
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
570572
drm_mode_set_name(mode);

0 commit comments

Comments
 (0)