diff options
| author | Lin YuChen <starpt.official@gmail.com> | 2026-03-14 01:55:26 +0800 |
|---|---|---|
| committer | Sakari Ailus <sakari.ailus@linux.intel.com> | 2026-05-20 13:21:40 +0300 |
| commit | 4d542f256cf2ff23a4a2c5411cbdf9af0191b8ca (patch) | |
| tree | 49d7b3aa1ac87c30e3f2cbf0b0f260334ad31cb0 | |
| parent | de1844c0da4ad2987bca07d299402a6c73ba902d (diff) | |
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>
| -rw-r--r-- | drivers/staging/media/atomisp/pci/sh_css_firmware.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index 57ecf5549c23..af12df2f9b09 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -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 { |
