Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] Unhandled return value of drm_connector_init() leading to potential 
kernel oops on allocation failure.
--

--- Patch [6]: [PATCH v2 06/15] drm/virtio: remove dependency on DRM simple 
helpers ---
commit c3e48910730cab2ede63c55569b1ea2f386b9c60
Author: Diogo Silva <[email protected]>

drm/virtio: remove dependency on DRM simple helpers

This commit removes the deprecated DRM simple KMS helper dependency
by open-coding drm_simple_encoder_init() into drm_encoder_init()
and correctly checking the return value to prevent silent failures.

> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
> b/drivers/gpu/drm/virtio/virtgpu_display.c
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c

[ ... ]

> @@ -306,7 +310,11 @@ static int vgdev_output_init(struct virtio_gpu_device 
> *vgdev, int index)
>       if (vgdev->has_edid)
>               drm_connector_attach_edid_property(connector);

[Severity: High]
This is a pre-existing issue, but looking at the context just
above these lines in vgdev_output_init(), the return value of
drm_connector_init() is ignored.

Since this patch corrects missing error handling for drm_encoder_init(),
would it make sense to also catch errors from drm_connector_init() in this
same function?

If drm_connector_init() fails (such as from resource exhaustion), the
connector structure is left uninitialized. Calling drm_connector_helper_add()
and drm_connector_attach_edid_property() subsequently will dereference this
uninitialized state, which can lead to a crash.

> -     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
> +     ret = drm_encoder_init(dev, encoder, &virtio_gpu_enc_funcs,
> +                            DRM_MODE_ENCODER_VIRTUAL, NULL);
> +     if (ret)
> +             return ret;
> +
>       drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=6

Reply via email to