]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm: virtio: fix kmem_cache_alloc error check
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 13 Mar 2017 08:22:26 +0000 (09:22 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 14 Mar 2017 10:54:19 +0000 (11:54 +0100)
kmem_cache_alloc returns NULL on error, not ERR_PTR.

Fixes: f5985bf9cadd4e3ed8d5d9a9cbbb2e39cdb81cd9
Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1489393346-13874-1-git-send-email-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_vq.c

index 472e34986a44441aba8bdd57f97d561db7ef6718..9eb96fb2c147940365918b9fa6ea6edeb51e976c 100644 (file)
@@ -97,8 +97,8 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev,
        struct virtio_gpu_vbuffer *vbuf;
 
        vbuf = kmem_cache_alloc(vgdev->vbufs, GFP_KERNEL);
-       if (IS_ERR(vbuf))
-               return ERR_CAST(vbuf);
+       if (!vbuf)
+               return ERR_PTR(-ENOMEM);
        memset(vbuf, 0, VBUFFER_SIZE);
 
        BUG_ON(size > MAX_INLINE_CMD_SIZE);