From: Leon Romanovsky <leon@kernel.org>
To: flyingpenghao@gmail.com
Cc: dennis.dalessandro@cornelisnetworks.com,
linux-rdma@vger.kernel.org, Peng Hao <flyingpeng@tencent.com>
Subject: Re: [PATCH] infiniband/hw/hfi1/tid_rdma: use kmalloc_array_node()
Date: Sun, 28 Jul 2024 10:53:34 +0300 [thread overview]
Message-ID: <20240728075334.GC4296@unreal> (raw)
In-Reply-To: <20240725071716.26136-1-flyingpeng@tencent.com>
On Thu, Jul 25, 2024 at 03:17:16PM +0800, flyingpenghao@gmail.com wrote:
> From: Peng Hao <flyingpeng@tencent.com>
>
> 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@tencent.com>
> ---
> 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
>
prev parent reply other threads:[~2024-07-28 7:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 7:17 [PATCH] infiniband/hw/hfi1/tid_rdma: use kmalloc_array_node() flyingpenghao
2024-07-25 11:58 ` Zhu Yanjun
2024-07-25 13:46 ` Dean Luick
2024-07-28 7:52 ` Leon Romanovsky
2024-07-28 7:53 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240728075334.GC4296@unreal \
--to=leon@kernel.org \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=flyingpeng@tencent.com \
--cc=flyingpenghao@gmail.com \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox