Re: [PATCH] staging: media: atomisp: use kmalloc_array() for sh_css_blob_info

From: Andy Shevchenko

Date: Fri Mar 13 2026 - 05:41:00 EST


On Fri, Mar 13, 2026 at 05:08:01AM +0800, Lin YuChen wrote:
> Replace the open-coded multiplication in kmalloc() with kmalloc_array()
> to provide overflow protection and improve code readability.

...

> + sh_css_blob_info =
> + kmalloc_array((sh_css_num_binaries - NUM_OF_SPS),

Too many parentheses.

> + sizeof(*sh_css_blob_info), GFP_KERNEL);
> if (!sh_css_blob_info)
> return -ENOMEM;

--
With Best Regards,
Andy Shevchenko