ACPI/IORT: Switch to use kmemdup_array()
Subsystems (2)
PATCH 1/1 ACPI/IORT: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows.
--- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/iort.c +1 -1
@@ -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 ;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Quoted 13 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/arm64/iort.c +0
-0
drivers/acpi/arm64/iort.c static struct iommu_iort_rmr_data *iort_rmr_alloc( · line 828
Quoted 8 lines
drivers/acpi/arm64/iort.c +1
-1@@ -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 ;
Looks good to me,
Hanjun Guo
maintainer+Cc Catalin
Quoted 25 lines · Hanjun Guo
Quoted 13 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.Signed-off-by Andy Shevchenko <[email protected]>---
drivers/acpi/arm64/iort.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/arm64/iort.c +0
-0drivers/acpi/arm64/iort.c static struct iommu_iort_rmr_data *iort_rmr_alloc( · line 828
Quoted 8 lines
drivers/acpi/arm64/iort.c +1
-1@@ -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;Looks good to me,
Quoted 1 line
Acked-by Hanjun Guo <[email protected]>
Catalin, would you mind pick this up as well?
Thanks
Hanjun
Quoted 28 lines · Hanjun Guo
+Cc Catalin
Quoted 25 lines · Hanjun Guo
Quoted 13 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.Signed-off-by Andy Shevchenko <[email protected]>---
drivers/acpi/arm64/iort.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/arm64/iort.c +0
-0drivers/acpi/arm64/iort.c static struct iommu_iort_rmr_data *iort_rmr_alloc( · line 828
Quoted 8 lines
drivers/acpi/arm64/iort.c +1
-1@@ -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;Looks good to me,
Quoted 3 lines
Quoted 1 line
Acked-by Hanjun Guo <[email protected]>Catalin, would you mind pick this up as well?
Any news?
I do not see this even in Linux Next...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Catalin Marinas
maintainerQuoted 29 lines · Andy Shevchenko
Quoted 28 lines · Hanjun Guo
+Cc Catalin
Quoted 25 lines · Hanjun Guo
Quoted 13 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.Signed-off-by Andy Shevchenko <[email protected]>---
drivers/acpi/arm64/iort.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/arm64/iort.c +0
-0drivers/acpi/arm64/iort.c static struct iommu_iort_rmr_data *iort_rmr_alloc( · line 828
Quoted 8 lines
drivers/acpi/arm64/iort.c +1
-1@@ -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;Looks good to me,
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Acked-by Hanjun Guo <[email protected]>Catalin, would you mind pick this up as well?
Any news?
I do not see this even in Linux Next...
Ah, sorry, I missed this. Since it doesn't look like a fix, I guess it's fine to go in 6.12. Adding Will since he's handling the upcoming merging window.
Signature · 1 line
Catalin
Hanjun Guo
maintainerQuoted 34 lines · Catalin Marinas
Quoted 33 lines · Andy Shevchenko
Quoted 31 lines · Hanjun Guo
+Cc Catalin
Quoted 25 lines · Hanjun Guo
Quoted 13 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/arm64/iort.c +0
-0drivers/acpi/arm64/iort.c static struct iommu_iort_rmr_data *iort_rmr_alloc( · line 828
Quoted 8 lines
drivers/acpi/arm64/iort.c +1
-1@@ -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;Looks good to me,
Quoted 1 line
Acked-by Hanjun Guo <[email protected]>Catalin, would you mind pick this up as well?
Quoted 7 lines
Quoted 3 lines
Any news?
I do not see this even in Linux Next...
Ah, sorry, I missed this. Since it doesn't look like a fix, I guess it's fine to go in 6.12. Adding Will since he's handling the upcoming merging window.
Sorry, I sent another email almost at the same time, so missed this one.
Thanks
Hanjun
Quoted 1 line · Catalin Marinas
On Fri, Aug 09, 2024 at 03:16:34PM +0300, Andy Shevchenko wrote:
...
Quoted 2 lines
Ah, sorry, I missed this. Since it doesn't look like a fix, I guess it's fine to go in 6.12.
No, it's definitely not a fix, it's a simple cleanup. Hence v6.12 is quite okay, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hanjun Guo
maintainerQuoted 29 lines · Andy Shevchenko
Quoted 28 lines · Hanjun Guo
+Cc Catalin
Quoted 25 lines · Hanjun Guo
Quoted 13 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/arm64/iort.c +0
-0drivers/acpi/arm64/iort.c static struct iommu_iort_rmr_data *iort_rmr_alloc( · line 828
Quoted 8 lines
drivers/acpi/arm64/iort.c +1
-1@@ -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;Looks good to me,
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Acked-by Hanjun Guo <[email protected]>Catalin, would you mind pick this up as well?
Any news?
I do not see this even in Linux Next...
Sudeep, Lorenzo, would you mind giving it a go?
Thanks
Hanjun
Quoted 4 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.
Applied to arm64 (for-next/acpi), thanks!
[1/1] ACPI/IORT: Switch to use kmemdup_array()
https://git.kernel.org/arm64/c/9cd8062b38e6
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev