public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ACPI/IORT: Switch to use kmemdup_array()
@ 2024-06-06 16:50 Andy Shevchenko
  2024-06-11 10:42 ` Hanjun Guo
  2024-08-16 15:15 ` Will Deacon
  0 siblings, 2 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-06-06 16:50 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel, linux-kernel
  Cc: Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Rafael J. Wysocki,
	Len Brown, Andy Shevchenko

Let the kememdup_array() take care about multiplication and possible
overflows.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/arm64/iort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index c0b1c2c19444..e596dff20f1e 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -822,7 +822,7 @@ static struct iommu_iort_rmr_data *iort_rmr_alloc(
 		return NULL;
 
 	/* Create a copy of SIDs array to associate with this rmr_data */
-	sids_copy = kmemdup(sids, num_sids * sizeof(*sids), GFP_KERNEL);
+	sids_copy = kmemdup_array(sids, num_sids, sizeof(*sids), GFP_KERNEL);
 	if (!sids_copy) {
 		kfree(rmr_data);
 		return NULL;
-- 
2.43.0.rc1.1336.g36b5255a03ac


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-16 15:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06 16:50 [PATCH v1 1/1] ACPI/IORT: Switch to use kmemdup_array() Andy Shevchenko
2024-06-11 10:42 ` Hanjun Guo
2024-06-14  0:54   ` Hanjun Guo
2024-08-09 12:16     ` Andy Shevchenko
2024-08-09 12:52       ` Catalin Marinas
2024-08-09 13:16         ` Hanjun Guo
2024-08-09 13:46         ` Andy Shevchenko
2024-08-09 12:52       ` Hanjun Guo
2024-08-16 15:15 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox