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

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Dec 2 18:00:54 PST 2024


On 11/30/24 09:02, 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.
>
> Reported-by: kernel test robot<lkp at intel.com>
> Closes:https://lore.kernel.org/oe-kbuild-all/202411301434.LEckbcWx-lkp@intel.com/
> Reviewed-by: Kuan-Wei Chiu<visitorckw at gmail.com>
> Signed-off-by: Yu-Chun Lin<eleanor15x at gmail.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>

-ck




More information about the Linux-nvme mailing list