From: Jason Gunthorpe <jgg@nvidia.com>
To: Qianfeng Rong <rongqianfeng@vivo.com>
Cc: Cheng Xu <chengyou@linux.alibaba.com>,
Kai Shen <kaishen@linux.alibaba.com>,
Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Markus.Elfring@web.de
Subject: Re: [PATCH v2] RDMA/erdma: Use vcalloc() instead of vzalloc()
Date: Mon, 25 Aug 2025 15:19:29 -0300 [thread overview]
Message-ID: <20250825181929.GA2088087@nvidia.com> (raw)
In-Reply-To: <20250821072209.510348-1-rongqianfeng@vivo.com>
On Thu, Aug 21, 2025 at 03:22:09PM +0800, Qianfeng Rong wrote:
> Replace vzalloc() with vcalloc() in vmalloc_to_dma_addrs(). As noted
> in the kernel documentation [1], open-coded multiplication in allocator
> arguments is discouraged because it can lead to integer overflow.
>
> Use vcalloc() to gain built-in overflow protection, making memory
> allocation safer when calculating allocation size compared to explicit
> multiplication.
>
> [1]: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
> v2: change sizeof(dma_addr_t) to sizeof(*pg_dma) to improve code
> robustness as suggested by Markus.
> ---
> drivers/infiniband/hw/erdma/erdma_verbs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next, thanks
Jason
prev parent reply other threads:[~2025-08-25 18:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 7:22 [PATCH v2] RDMA/erdma: Use vcalloc() instead of vzalloc() Qianfeng Rong
2025-08-21 9:26 ` Cheng Xu
2025-08-25 18:19 ` Jason Gunthorpe [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=20250825181929.GA2088087@nvidia.com \
--to=jgg@nvidia.com \
--cc=Markus.Elfring@web.de \
--cc=chengyou@linux.alibaba.com \
--cc=kaishen@linux.alibaba.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=rongqianfeng@vivo.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.