drm/virtio: Fix an NULL vs IS_ERR() bug in virtio_gpu_object_shmem_init()
Subsystems (5)
PATCH v2 1/1 drm/virtio: Fix an NULL vs IS_ERR() bug in virtio_gpu_object_shmem_init()
The drm_gem_shmem_get_sg_table() function never returns NULL. It returns error pointers on error.
Fixes c66df701e783 ("drm/virtio: switch from ttm to gem shmem helpers")
Signed-off-by Dan Carpenter <[email protected]>
---
v2: I originally sent this patch on 19 Jun 2020 but it was somehow
not applied. As I review it now, I see that the bug is actually older than I originally thought and so I have updated the Fixes tag.
drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_object.c +2 -2
@@ -168,9 +168,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,* since virtio_gpu doesn't support dma-buf import from other devices. */ shmem->pages =drm_gem_shmem_get_sg_table (&bo->base.base); -if (!shmem->pages) { +if (IS_ERR (shmem->pages)) {drm_gem_shmem_unpin (&bo->base.base); -return -EINVAL ; +return PTR_ERR (shmem->pages); }if (use_dma_api) {
Signature · 1 line
2.20.1
Quoted 11 lines · Dan Carpenter
The
drm_gem_shmem_get_sg_table()function never returns NULL. It returns error pointers on error.Fixes c66df701e783 ("drm/virtio: switch from ttm to gem shmem helpers")Signed-off-by Dan Carpenter <[email protected]>---
v2: I originally sent this patch on 19 Jun 2020 but it was somehow
not applied. As I review it now, I see that the bug is actually older than I originally thought and so I have updated the Fixes tag.
Reviewed-by Chia-I Wu <[email protected]>