Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Naman Arora" <namanarora029@gmail.com>
Cc: neil.armstrong@linaro.org, linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 3/6] drm/virtio: Open-code drm_simple_encoder_init()
Date: Sun, 31 May 2026 08:00:54 +0000	[thread overview]
Message-ID: <20260531080055.032E81F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260531073532.8609-4-namanarora029@gmail.com>

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

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the return value of drm_encoder_init() is ignored, meaning failures during initialization go undetected and could lead to a kernel panic or oops.
--

commit 2aea64f30defed1555346f1f9a6d96e4b1c548c9
Author: Naman Arora <namanarora029@gmail.com>

drm/virtio: Open-code drm_simple_encoder_init()

This commit replaces the drm_simple_encoder_init() wrapper with an open-coded
drm_encoder_init() in the virtio driver to remove the dependency on the
drm_simple_kms_helper.

> 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 +309,8 @@ 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_drm_encoder_funcs,
> +			 DRM_MODE_ENCODER_VIRTUAL, NULL);

[Severity: High]
This isn't a bug introduced by this patch, but should the return value of
drm_encoder_init() be checked in vgdev_output_init() here?

If drm_encoder_init() fails (for example, returning -ENOMEM if allocating
the encoder name fails), the error is ignored. Does this allow the code to
proceed and attach an incompletely initialized encoder to the connector,
potentially leading to a NULL pointer dereference or crash later when the DRM
core 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/20260531074627.8936-1-namanarora029@gmail.com?part=3

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-05-31  8:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-31  7:35 [PATCH 0/6] drm: Open-code drm_simple_encoder_init() in several drivers Naman Arora
2026-05-31  7:35 ` [PATCH 1/6] drm/fsl-dcu: Open-code drm_simple_encoder_init() Naman Arora
2026-05-31  7:35 ` [PATCH 2/6] drm/tidss: " Naman Arora
2026-05-31  7:57   ` sashiko-bot
2026-05-31  7:35 ` [PATCH 3/6] drm/virtio: " Naman Arora
2026-05-31  8:00   ` sashiko-bot [this message]
2026-05-31  7:46 ` [PATCH 4/6] drm/meson: Open-code drm_simple_encoder_init() in encoder_cvbs Naman Arora
2026-05-31  7:46   ` [PATCH 5/6] drm/meson: Open-code drm_simple_encoder_init() in encoder_hdmi Naman Arora
2026-05-31  8:17     ` sashiko-bot
2026-05-31  7:46   ` [PATCH 6/6] drm/meson: Open-code drm_simple_encoder_init() in encoder_dsi Naman Arora
2026-05-31  8:25     ` sashiko-bot
2026-05-31  8:08   ` [PATCH 4/6] drm/meson: Open-code drm_simple_encoder_init() in encoder_cvbs sashiko-bot

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=20260531080055.032E81F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=namanarora029@gmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox