On 9/22/25 17:44, Alexandr Sapozhnkiov wrote:
> 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.
> Signed-off-by: Alexandr Sapozhnikov <[email protected]>
> ---
>  drivers/gpu/drm/virtio/virtgpu_display.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
> b/drivers/gpu/drm/virtio/virtgpu_display.c
> index ad924a8502e9..59b652e8a630 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -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,

Patch will need a cosmetic correction for the indentation that I'll
change while applying, thanks.

Reviewed-by: Dmitry Osipenko <[email protected]>

-- 
Best regards,
Dmitry

Reply via email to