Re: [PATCH] RDMA/erdma: Use vcalloc() instead of vzalloc()

From: Markus Elfring
Date: Wed Aug 20 2025 - 10:36:25 EST


> Replace vzalloc() with vcalloc() in vmalloc_to_dma_addrs(). …




> +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
> @@ -671,7 +671,7 @@ static u32 vmalloc_to_dma_addrs(struct erdma_dev *dev, dma_addr_t **dma_addrs,
>
> npages = (PAGE_ALIGN((u64)buf + len) - PAGE_ALIGN_DOWN((u64)buf)) >>
> PAGE_SHIFT;
> - pg_dma = vzalloc(npages * sizeof(dma_addr_t));
> + pg_dma = vcalloc(npages, sizeof(dma_addr_t));


How do you think about to adjust also the size determination?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.17-rc2#n944

pg_dma = vcalloc(npages, sizeof(*pg_dma));


Regards,
Markus