* [bug report] drm/amdkfd: Add DMABuf import functionality
@ 2018-12-14 15:01 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-12-14 15:01 UTC (permalink / raw)
To: Felix.Kuehling-5C7GfCeVMHo; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-14 15:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-14 15:01 [bug report] drm/amdkfd: Add DMABuf import functionality Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox