drm/edid: fix a possible null pointer dereference
Subsystems (2)
PATCH 1/1 drm/edid: fix a possible null pointer dereference
In drm_mode_std(), the return value of drm_gtf_mode(), drm_gtf_mode() and drm_cvt_mode() is assigned to mode, which will lead to a NULL pointer dereference on failure of drm_gtf_mode(), drm_gtf_mode() and drm_cvt_mode(). Add a check to avoid null point dereference.
Signed-off-by Ma Ke <[email protected]>
--- drivers/gpu/drm/drm_edid.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_edid.c +2 -0
@@ -3381,6 +3381,8 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector, false);break ; } +if (!mode) +return NULL ;return mode; }
Signature · 1 line
2.37.2
Quoted 16 lines · Ma Ke
In
drm_mode_std(), the return value ofdrm_gtf_mode(),drm_gtf_mode()anddrm_cvt_mode()is assigned to mode, which will lead to a NULL pointer dereference on failure ofdrm_gtf_mode(),drm_gtf_mode()anddrm_cvt_mode(). Add a check to avoid null point dereference.Signed-off-by Ma Ke <[email protected]>--- drivers/gpu/drm/drm_edid.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/drm_edid.c +0
-0
drivers/gpu/drm/drm_edid.c static struct drm_display_mode *drm_mode_std(struct drm_connector *connector, · line 3385
Quoted 5 lines
drivers/gpu/drm/drm_edid.c +2
-0@@ -3381,6 +3381,8 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector, false);break ; } +if (!mode) +return NULL ;
This doesn't change anything.
BR,
Jani.
Quoted 2 lines
drivers/gpu/drm/drm_edid.c +0
-0return mode; }
Signature · 1 line
Jani Nikula, Intel