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 08:46:30AM -0500, Dean Luick wrote:
> On 7/25/2024 2:17 AM, 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.
> >
> > 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;
> 
> This is clearly not going to overflow.  I see no reason to change it.
> 
> However, I don't know the current policy on such replacements.

There is no policy. My preference is to change if other changes are done in
the same area, but do not change something that is not broken.

Thanks

> 
> -Dean
> 
> External recipient
> 




[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