All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Felix.Kuehling-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [bug report] drm/amdkfd: Add DMABuf import functionality
Date: Fri, 14 Dec 2018 18:01:13 +0300	[thread overview]
Message-ID: <20181214150113.GA10936@kadam> (raw)

Hello Felix Kuehling,

The patch 1dde0ea95b78: "drm/amdkfd: Add DMABuf import functionality"
from Nov 20, 2018, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c:1643 kfd_ioctl_import_dmabuf()
	error: 'dmabuf' dereferencing possible ERR_PTR()

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c
  1615  static int kfd_ioctl_import_dmabuf(struct file *filep,
  1616                                     struct kfd_process *p, void *data)
  1617  {
  1618          struct kfd_ioctl_import_dmabuf_args *args = data;
  1619          struct kfd_process_device *pdd;
  1620          struct dma_buf *dmabuf;
  1621          struct kfd_dev *dev;
  1622          int idr_handle;
  1623          uint64_t size;
  1624          void *mem;
  1625          int r;
  1626  
  1627          dev = kfd_device_by_id(args->gpu_id);
  1628          if (!dev)
  1629                  return -EINVAL;
  1630  
  1631          dmabuf = dma_buf_get(args->dmabuf_fd);
                         ^^^^^^^^^^^^
returns error pointers and maybe NULL as well?

  1632          if (!dmabuf)
  1633                  return -EINVAL;
  1634  
  1635          mutex_lock(&p->mutex);
  1636  
  1637          pdd = kfd_bind_process_to_device(dev, p);
  1638          if (IS_ERR(pdd)) {
  1639                  r = PTR_ERR(pdd);
  1640                  goto err_unlock;
  1641          }
  1642  
  1643          r = amdgpu_amdkfd_gpuvm_import_dmabuf(dev->kgd, dmabuf,
                                                                ^^^^^^
Dereferenced inside function.

  1644                                                args->va_addr, pdd->vm,
  1645                                                (struct kgd_mem **)&mem, &size,
  1646                                                NULL);
  1647          if (r)
  1648                  goto err_unlock;

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

                 reply	other threads:[~2018-12-14 15:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20181214150113.GA10936@kadam \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=Felix.Kuehling-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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.