[PATCH] nvmet: replace kmalloc + memset with kzalloc for data allocation

Keith Busch kbusch at kernel.org
Tue Dec 3 11:03:05 PST 2024


On Sun, Dec 01, 2024 at 01:02:58AM +0800, Yu-Chun Lin wrote:
> cocci warnings: (new ones prefixed by >>)
> >> drivers/nvme/target/pr.c:831:8-15: WARNING: kzalloc should be used for data, instead of kmalloc/memset
> 
> The pattern of using 'kmalloc' followed by 'memset' is replaced with
> 'kzalloc', which is functionally equivalent to 'kmalloc' + 'memset',
> but more efficient. 'kzalloc' automatically zeroes the allocated
> memory, making it a faster and more streamlined solution.

Thanks, applied to nvme-6.13.



More information about the Linux-nvme mailing list