gpu/drm/virtio: fix error return in vgdev_output_init()
Subsystems (4)
PATCH 1/1 gpu/drm/virtio: fix error return in vgdev_output_init()
From: Alexandr Sapozhnikov <[email protected]>
Return value of function drm_crtc_init_with_planes(), called at virtgpu_display.c:276, is not checked, but it is usually checked for this function
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/gpu/drm/virtio/virtgpu_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +4 -1
@@ -253,6 +253,7 @@ static const struct drm_connector_funcs virtio_gpu_connector_funcs = {static int vgdev_output_init (struct virtio_gpu_device *vgdev,int index) { +int ret;struct drm_device *dev = vgdev->ddev;struct virtio_gpu_output *output = vgdev->outputs + index;struct drm_connector *connector = &output->conn;
@@ -273,8 +274,10 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index) cursor =virtio_gpu_plane_init (vgdev,DRM_PLANE_TYPE_CURSOR , index);if (IS_ERR (cursor))return PTR_ERR (cursor); -drm_crtc_init_with_planes (dev, crtc, primary, cursor, + ret =drm_crtc_init_with_planes (dev, crtc, primary, cursor, &virtio_gpu_crtc_funcs,NULL ); +if (ret) +return ret;drm_crtc_helper_add (crtc, &virtio_gpu_crtc_helper_funcs); drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
Signature · 1 line
2.43.0
Quoted 26 lines · Alexandr Sapozhnkiov
From: Alexandr Sapozhnikov <[email protected]>
Return value of function
drm_crtc_init_with_planes(), called at virtgpu_display.c:276, is not checked, but it is usually checked for this functionFound by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by Alexandr Sapozhnikov <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/virtio/virtgpu_display.c +1
-0@@ -253,6 +253,7 @@ static const struct drm_connector_funcs virtio_gpu_connector_funcs = {static int vgdev_output_init (struct virtio_gpu_device *vgdev,int index) { +int ret;struct drm_device *dev = vgdev->ddev;struct virtio_gpu_output *output = vgdev->outputs + index;struct drm_connector *connector = &output->conn;@@ -273,8 +274,10 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index) cursor =virtio_gpu_plane_init (vgdev,DRM_PLANE_TYPE_CURSOR , index);
drivers/gpu/drm/virtio/virtgpu_display.c static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index) · line 283
Quoted 10 lines
drivers/gpu/drm/virtio/virtgpu_display.c +3
-1if (IS_ERR (cursor))return PTR_ERR (cursor); -drm_crtc_init_with_planes (dev, crtc, primary, cursor, + ret =drm_crtc_init_with_planes (dev, crtc, primary, cursor, &virtio_gpu_crtc_funcs,NULL ); +if (ret) +return ret;drm_crtc_helper_add (crtc, &virtio_gpu_crtc_helper_funcs); drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
Patch will need a cosmetic correction for the indentation that I'll change while applying, thanks.
Signature · 2 lines
Best regards, Dmitry
drivers/gpu/drm/virtio/virtgpu_display.c static const struct drm_connector_funcs virtio_gpu_connector_funcs = {
Quoted 17 lines · Alexandr Sapozhnkiov
From: Alexandr Sapozhnikov <[email protected]>
Return value of function
drm_crtc_init_with_planes(), called at virtgpu_display.c:276, is not checked, but it is usually checked for this functionFound by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by Alexandr Sapozhnikov <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/virtio/virtgpu_display.c +0
-0@@ -253,6 +253,7 @@ static const struct drm_connector_funcs virtio_gpu_connector_funcs = {
Applied to misc-next with corrected coding style and edited commit message, thanks.
Signature · 2 lines
Best regards, Dmitry