All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonyoung Shim <jy0922.shim@samsung.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-samsung-soc@vger.kernel.org
Subject: Re: drm/exynos: merge exynos_drm_buf.c to exynos_drm_gem.c
Date: Wed, 19 Aug 2015 18:25:29 +0900	[thread overview]
Message-ID: <55D44B89.8000407@samsung.com> (raw)
In-Reply-To: <20150819083546.GA5271@mwanda>

Hi,

On 08/19/2015 05:35 PM, Dan Carpenter wrote:
> Hello Joonyoung Shim,
> 
> The patch 2a8cb4894540: "drm/exynos: merge exynos_drm_buf.c to
> exynos_drm_gem.c" from Aug 16, 2015, leads to the following static
> checker warning:
> 
> 	drivers/gpu/drm/exynos/exynos_drm_gem.c:610 exynos_drm_gem_prime_import_sg_table()
> 	error: 'exynos_gem_obj' dereferencing possible ERR_PTR()
> 

Thanks for reporting.

> drivers/gpu/drm/exynos/exynos_drm_gem.c
>    562  struct drm_gem_object *
>    563  exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
>    564                                       struct dma_buf_attachment *attach,
>    565                                       struct sg_table *sgt)
>    566  {
>    567          struct exynos_drm_gem_obj *exynos_gem_obj;
>    568          int npages;
>    569          int ret;
>    570  
>    571          exynos_gem_obj = exynos_drm_gem_init(dev, attach->dmabuf->size);
>    572          if (IS_ERR(exynos_gem_obj)) {
>    573                  ret = PTR_ERR(exynos_gem_obj);
> 
> exynos_gem_obj is an ERR_PTR.
> 
>    574                  goto err;

My fault, just should return exynos_gem_obj.

>    575          }
>    576  
>    577          exynos_gem_obj->dma_addr = sg_dma_address(sgt->sgl);
> 
>    603  
>    604          return &exynos_gem_obj->base;
>    605  
>    606  err_free_large:
>    607          drm_free_large(exynos_gem_obj->pages);
>    608  err:
>    609          drm_gem_object_release(&exynos_gem_obj->base);
>    610          kfree(exynos_gem_obj);
> 
> So both the drm_gem_object_release() and kfree() will crash.  Do we
> really need both?  I feel like there should be a single free function
> which undoes the exynos_drm_gem_init() function.  Also the
> exynos_drm_gem_init() has no documentation about how it is supposed to
> be freed.

drm_gem_object_release() and kfree() are functions that undo                                                          
exynos_drm_gem_init(). I think there does not have to be a single free                                                
function certainly.

      reply	other threads:[~2015-08-19  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  8:35 drm/exynos: merge exynos_drm_buf.c to exynos_drm_gem.c Dan Carpenter
2015-08-19  9:25 ` Joonyoung Shim [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=55D44B89.8000407@samsung.com \
    --to=jy0922.shim@samsung.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-samsung-soc@vger.kernel.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.