Commit 7bd09a2d authored by Chen Ni's avatar Chen Ni Committed by Maxime Ripard

drm/qxl: Add check for drm_cvt_mode

Add check for the return value of drm_cvt_mode() and return the error if
it fails in order to avoid NULL pointer dereference.

Fixes: 1b043677 ("drm/qxl: add qxl_add_mode helper function")
Signed-off-by: default avatarChen Ni <nichen@iscas.ac.cn>
Reviewed-by: default avatarHeng Qi <hengqi@linux.alibaba.com>
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240621071031.1987974-1-nichen@iscas.ac.cn
parent 97370f8e
...@@ -236,6 +236,9 @@ static int qxl_add_mode(struct drm_connector *connector, ...@@ -236,6 +236,9 @@ static int qxl_add_mode(struct drm_connector *connector,
return 0; return 0;
mode = drm_cvt_mode(dev, width, height, 60, false, false, false); mode = drm_cvt_mode(dev, width, height, 60, false, false, false);
if (!mode)
return 0;
if (preferred) if (preferred)
mode->type |= DRM_MODE_TYPE_PREFERRED; mode->type |= DRM_MODE_TYPE_PREFERRED;
mode->hdisplay = width; mode->hdisplay = width;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment