Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Missing error check for drm_encoder_init return value. --
commit 731688e34b570f6cb070588f1d74f9b42481123c Author: Davide Bonatto <[email protected]> drm/virtio: Replace deprecated drm_simple_encoder_init() This patch replaces the deprecated drm_simple_encoder_init() with a direct call to drm_encoder_init(), defining a default cleanup callback directly in virtio_gpu_encoder_funcs. > diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c > b/drivers/gpu/drm/virtio/virtgpu_display.c > index a1a875a0c706a..85986578001fe 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_display.c > +++ b/drivers/gpu/drm/virtio/virtgpu_display.c [ ... ] > @@ -306,7 +310,9 @@ static int vgdev_output_init(struct virtio_gpu_device > *vgdev, int index) > if (vgdev->has_edid) > drm_connector_attach_edid_property(connector); > > - drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL); > + drm_encoder_init(dev, encoder, &virtio_gpu_encoder_funcs, > + DRM_MODE_ENCODER_VIRTUAL, NULL); [Severity: Medium] Does this code need to check the return value of drm_encoder_init()? If drm_encoder_init() fails (for example, due to a memory allocation failure for the encoder name), it returns a negative error code like -ENOMEM and cleans up the partially initialized object. Since this return value is not validated in vgdev_output_init(), the function will proceed to use the uninitialized encoder, attaching it to a connector and registering the connector with userspace. Could this lead to a NULL pointer dereference or corrupted state when the DRM subsystem interacts with it? > + > drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs); > encoder->possible_crtcs = 1 << index; > -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
