Re: [PATCH] infiniband/hw/hfi1/tid_rdma: use kmalloc_array_node()

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

 



On Thu, Jul 25, 2024 at 03:17:16PM +0800, flyingpenghao@xxxxxxxxx wrote:
> From: Peng Hao <flyingpeng@xxxxxxxxxxx>
> 
> kmalloc_array_node() is a NUMA-aware version of kmalloc_array that
> has overflow checking and can be used as a replacement for kmalloc_node.

Original code is correct, the overflow is not going to happen.

Thanks

> 
> Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/hfi1/tid_rdma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
> index c465966a1d9c..6b1921f6280b 100644
> --- a/drivers/infiniband/hw/hfi1/tid_rdma.c
> +++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
> @@ -1636,7 +1636,7 @@ static int hfi1_kern_exp_rcv_alloc_flows(struct tid_rdma_request *req,
>  
>  	if (likely(req->flows))
>  		return 0;
> -	flows = kmalloc_node(MAX_FLOWS * sizeof(*flows), gfp,
> +	flows = kmalloc_array_node(MAX_FLOWS, sizeof(*flows), gfp,
>  			     req->rcd->numa_id);
>  	if (!flows)
>  		return -ENOMEM;
> -- 
> 2.27.0
> 




[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