Re: [patch] vhost: NULL vs ERR_PTR bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 15, 2015 at 02:16:59PM +0300, Dan Carpenter wrote:
> There is only one caller for vhost_kvzalloc() and it expects NULL on
> allocation failure.  Most people would probably expect that so let's
> change ERR_PTR(-ENOMEM) to NULL.
> 
> Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Ouch. Thanks a lot for noticing this, and it's a good thing
you did before Linus merged it.
I'll squash this into Igor's patch and redo my pull request.

> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index a9fe859..99d613b 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -686,7 +686,7 @@ static void *vhost_kvzalloc(unsigned long size)
>  	if (!n) {
>  		n = vzalloc(size);
>  		if (!n)
> -			return ERR_PTR(-ENOMEM);
> +			return NULL;
>  	}
>  	return n;
>  }
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux