drm/qxl: Add check for drm_cvt_mode
[ Upstream commit 7bd09a2db0f617377027a2bb0b9179e6959edff3 ]
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: 1b043677d4
("drm/qxl: add qxl_add_mode helper function")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Heng Qi <hengqi@linux.alibaba.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240621071031.1987974-1-nichen@iscas.ac.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Родитель
4b60f8c55b
Коммит
3efe34f95b
|
@ -233,6 +233,9 @@ static int qxl_add_mode(struct drm_connector *connector,
|
|||
return 0;
|
||||
|
||||
mode = drm_cvt_mode(dev, width, height, 60, false, false, false);
|
||||
if (!mode)
|
||||
return 0;
|
||||
|
||||
if (preferred)
|
||||
mode->type |= DRM_MODE_TYPE_PREFERRED;
|
||||
mode->hdisplay = width;
|
||||
|
|
Загрузка…
Ссылка в новой задаче