All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: noralf@tronnes.org, Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/gem: Add drm_gem_object_funcs
Date: Wed, 26 Oct 2022 12:59:44 +0300	[thread overview]
Message-ID: <Y1kFEGxT8MVlf32V@kili> (raw)

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.

    241                 drm_gem_object_put(buffer->gem);
    242 
    243         if (buffer->handle)
    244                 drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
    245 
    246         kfree(buffer);
    247 }

regards,
dan carpenter

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  9:59 Dan Carpenter [this message]
2022-10-26 11:24 ` [bug report] drm/gem: Add drm_gem_object_funcs Dmitry Osipenko

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=Y1kFEGxT8MVlf32V@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dmitry.osipenko@collabora.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.