From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Dan Carpenter <error27@gmail.com>, Dave Airlie <airlied@gmail.com>
Cc: David Airlie <airlied@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Gurchetan Singh <gurchetansingh@chromium.org>,
Chia-I Wu <olvaffe@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Simona Vetter <simona@ffwll.ch>,
"Michael S. Tsirkin" <mst@redhat.com>,
dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/virtio: Fix a NULL vs ERR_PTR() bug in virtio_gpu_user_framebuffer_create()
Date: Fri, 14 Aug 2026 16:42:18 +0300 [thread overview]
Message-ID: <bfef9236-90f5-4795-be3a-5d522c1de05a@collabora.com> (raw)
In-Reply-To: <an1tWfHIHwtXd9SO@stanley.mountain>
On 8/13/26 10:08, Dan Carpenter wrote:
> Smatch complains that returning a NULL here will lead to a NULL pointer
> dereference in drm_mode_addfb2(). Return an error pointer instead.
>
> Fixes: dc5698e80cf7 ("Add virtio gpu driver.")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> This code is obviously over a decade old. I think this patch is correct.
> None of the other implementations return NULL, but I haven't tested it.
> ---
> drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> index 44ffffec550f..85ea252c658e 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -344,7 +344,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
> if (ret) {
> kfree(virtio_gpu_fb);
> drm_gem_object_put(obj);
> - return NULL;
> + return ERR_PTR(ret);
> }
>
> return &virtio_gpu_fb->base;
Applied to drm-misc-fixes, thanks!
--
Best regards,
Dmitry
prev parent reply other threads:[~2026-08-14 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 7:08 [PATCH] drm/virtio: Fix a NULL vs ERR_PTR() bug in virtio_gpu_user_framebuffer_create() Dan Carpenter
2026-08-14 13:42 ` Dmitry Osipenko [this message]
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=bfef9236-90f5-4795-be3a-5d522c1de05a@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=error27@gmail.com \
--cc=gurchetansingh@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=mst@redhat.com \
--cc=olvaffe@gmail.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox