Skip to content

Commit 9cd8062

Browse files
andy-shevwilldeacon
authored andcommitted
ACPI/IORT: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Hanjun Guo <guohanjun@huawei.com> Link: https://lore.kernel.org/r/20240606165005.3031490-1-andriy.shevchenko@linux.intel.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 7c626ce commit 9cd8062

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/acpi/arm64/iort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ static struct iommu_iort_rmr_data *iort_rmr_alloc(
822822
return NULL;
823823

824824
/* Create a copy of SIDs array to associate with this rmr_data */
825-
sids_copy = kmemdup(sids, num_sids * sizeof(*sids), GFP_KERNEL);
825+
sids_copy = kmemdup_array(sids, num_sids, sizeof(*sids), GFP_KERNEL);
826826
if (!sids_copy) {
827827
kfree(rmr_data);
828828
return NULL;

0 commit comments

Comments
 (0)