Re: [PATCH V1] IB/core: Do not allocate more memory than required for cma_configfs

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

 



On 12/31/2015 03:49 AM, Matan Barak wrote:
> We were allocating larger memory space than required for
> cma_dev_group->default_ports_group.
> 
> Fixes: 045959db65c6 ('IB/cma: Add configfs for rdma_cm')
> Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx>
> ---
> Hi Doug,
> 
> This patch fixes a small issue, where we allocated more space than we
> actually needed. This was introduces in the RoCE v2 series.
> 
> Regards,
> Matan
> 
> Changes from V0:
>  - Change subject and fix spelling mistake in commit message
> 
>  drivers/infiniband/core/cma_configfs.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
> index bd1d640..ab554df 100644
> --- a/drivers/infiniband/core/cma_configfs.c
> +++ b/drivers/infiniband/core/cma_configfs.c
> @@ -169,9 +169,10 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
>  	ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
>  			GFP_KERNEL);
>  
> -	cma_dev_group->default_ports_group = kcalloc(ports_num + 1,
> -						     sizeof(*cma_dev_group->ports),
> -						     GFP_KERNEL);
> +	cma_dev_group->default_ports_group =
> +		kcalloc(ports_num + 1,
> +			sizeof(*cma_dev_group->default_ports_group),
> +			GFP_KERNEL);
>  
>  	if (!ports || !cma_dev_group->default_ports_group) {
>  		err = -ENOMEM;
> 

Hi Matan, as I'm sure you saw, I grabbed Dan's patch for this.  I didn't
choose either one over the other, I just ran across his in patchworks
first as I was looking for all of the code I needed to review.

-- 
Doug Ledford <dledford@xxxxxxxxxx>
              GPG KeyID: 0E572FDD


Attachment: signature.asc
Description: OpenPGP digital signature


[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