Re: [PATCH rdma-next] RDMA/rxe: Clean kzalloc failure paths

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

 



On Wed, Mar 29, 2023 at 09:14:01PM +0300, Leon Romanovsky wrote:
> @@ -1287,11 +1279,8 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
>  	}
>  
>  	mr = kzalloc(sizeof(*mr), GFP_KERNEL);
> -	if (!mr) {
> -		err = -ENOMEM;
> -		rxe_dbg_mr(mr, "no memory for mr");
> -		goto err_out;
> -	}
> +	if (!mr)
> +		return ERR_PTR(-ENOMEM);
>  
>  	err = rxe_add_to_pool(&rxe->mr_pool, mr);
>  	if (err) {
        ^^^^^^^^^^
If the rxe_add_to_pool() fails then it calls:

	rxe_dbg_mr(mr, "unable to create mr, err = %d", err);
                   ^^

"rm" is zeroed mem and not useful at this point.  Possibly in a later
patch though.

regards,
dan carpenter




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux