mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
staging: media: atomisp: use kmalloc_array() for sh_css_blob_info
Replace the open-coded multiplication in kmalloc() with kmalloc_array() to provide overflow protection and improve code readability. Signed-off-by: Lin YuChen <starpt.official@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
parent
de1844c0da
commit
4d542f256c
|
|
@ -253,9 +253,9 @@ sh_css_load_firmware(struct device *dev, const char *fw_data,
|
|||
sh_css_num_binaries = file_header->binary_nr;
|
||||
/* Only allocate memory for ISP blob info */
|
||||
if (sh_css_num_binaries > NUM_OF_SPS) {
|
||||
sh_css_blob_info = kmalloc(
|
||||
(sh_css_num_binaries - NUM_OF_SPS) *
|
||||
sizeof(*sh_css_blob_info), GFP_KERNEL);
|
||||
sh_css_blob_info =
|
||||
kmalloc_array(sh_css_num_binaries - NUM_OF_SPS,
|
||||
sizeof(*sh_css_blob_info), GFP_KERNEL);
|
||||
if (!sh_css_blob_info)
|
||||
return -ENOMEM;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user