Re: [patch] NFS: kmalloc() doesn't return an ERR_PTR()

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

 



On 05/14/2012 10:45 PM, Dan Carpenter wrote:

> Obviously we should check for NULL here instead of IS_ERR().
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
> index ba3019f..233beea 100644
> --- a/fs/nfs/idmap.c
> +++ b/fs/nfs/idmap.c
> @@ -644,14 +644,14 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
>  
>  	/* msg and im are freed in idmap_pipe_destroy_msg */
>  	msg = kmalloc(sizeof(*msg), GFP_KERNEL);
> -	if (IS_ERR(msg)) {
> -		ret = PTR_ERR(msg);
> +	if (!msg) {


While at it please put an unlikely()

Thanks
Boaz

> +		ret = -ENOMEM;
>  		goto out0;
>  	}
>  
>  	im = kmalloc(sizeof(*im), GFP_KERNEL);
> -	if (IS_ERR(im)) {
> -		ret = PTR_ERR(im);
> +	if (!im) {
> +		ret = -ENOMEM;
>  		goto out1;
>  	}
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux