From: sashiko-bot@kernel.org
To: "Davide Bonatto" <bonatto.davide@gmail.com>
Cc: "Eugenio Perez" <eperezma@redhat.com>,
virtualization@lists.linux.dev, dri-devel@lists.freedesktop.org,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] drm/virtio: Replace deprecated drm_simple_encoder_init()
Date: Wed, 09 Sep 2026 07:44:37 +0000 [thread overview]
Message-ID: <20260909074438.658241F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909073440.52641-1-bonatto.davide@gmail.com>
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 <bonatto.davide@gmail.com>
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/20260909073440.52641-1-bonatto.davide@gmail.com?part=1
next prev parent reply other threads:[~2026-09-09 7:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 7:34 [PATCH] drm/virtio: Replace deprecated drm_simple_encoder_init() Davide Bonatto
2026-09-09 7:44 ` sashiko-bot [this message]
2026-09-09 7:52 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909074438.658241F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bonatto.davide@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.