lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170313102433.3okzlfvjwehhvplg@phenom.ffwll.local>
Date:   Mon, 13 Mar 2017 11:24:33 +0100
From:   Daniel Vetter <daniel@...ll.ch>
To:     Gerd Hoffmann <kraxel@...hat.com>
Cc:     dri-devel@...ts.freedesktop.org,
        open list <linux-kernel@...r.kernel.org>,
        "open list:VIRTIO GPU DRIVER" 
        <virtualization@...ts.linux-foundation.org>
Subject: Re: [PATCH] drm: virtio: fix kmem_cache_alloc error check

On Mon, Mar 13, 2017 at 09:22:26AM +0100, Gerd Hoffmann wrote:
> kmem_cache_alloc returns NULL on error, not ERR_PTR.
> 
> Fixes: f5985bf9cadd4e3ed8d5d9a9cbbb2e39cdb81cd9
> Reported-by: Jiri Slaby <jslaby@...e.cz>
> Signed-off-by: Gerd Hoffmann <kraxel@...hat.com>

I guess we should have smatch integrated into 0day to catch these ...

Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>

> ---
>  drivers/gpu/drm/virtio/virtgpu_vq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 472e349..9eb96fb2 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -97,8 +97,8 @@ void virtio_gpu_free_vbufs(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);
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ