All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, noralf@tronnes.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [bug report] drm/gem: Add drm_gem_object_funcs
Date: Wed, 26 Oct 2022 14:24:23 +0300	[thread overview]
Message-ID: <514fa15a-b039-2f84-1be8-b881fee72235@collabora.com> (raw)
In-Reply-To: <Y1kFEGxT8MVlf32V@kili>

On 10/26/22 12:59, Dan Carpenter wrote:
> Hello Noralf Trønnes,
> 
> The patch b39b5394fabc: "drm/gem: Add drm_gem_object_funcs" from Nov
> 10, 2018, leads to the following Smatch static checker warning:
> 
> 	drivers/gpu/drm/drm_client.c:240 drm_client_buffer_delete()
> 	warn: variable dereferenced before check 'buffer->gem' (see line 238)
> 
> drivers/gpu/drm/drm_client.c
>     234 static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
>     235 {
>     236         struct drm_device *dev = buffer->client->dev;
>     237 
>     238         drm_gem_vunmap_unlocked(buffer->gem, &buffer->map);
>                                         ^^^^^^^^^^^
> Unchecked dereference inside function call.
> 
>     239 
> --> 240         if (buffer->gem)
>                     ^^^^^^^^^^^
> Too late.  I don't honestly, know why this warning is only showing up
> now four years later.  Perhaps Smatch thought buffer->gem was always
> non-NULL before but now it's not sure.  I've added Dmitry to the CC list
> because he seems to has been working in this area recently and might
> know what's going on.

This is a valid bug. Before my changes drm_gem_vunmap() wasn't touching
buffer->gem when buffer->map=NULL, now it will. I'll prepare the fix,
thank you for the report.

-- 
Best regards,
Dmitry


      reply	other threads:[~2022-10-26 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  9:59 [bug report] drm/gem: Add drm_gem_object_funcs Dan Carpenter
2022-10-26 11:24 ` 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=514fa15a-b039-2f84-1be8-b881fee72235@collabora.com \
    --to=dmitry.osipenko@collabora.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=noralf@tronnes.org \
    /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.