[PATCH v1] drivers:intel_th:Switch to use kmemdup_array()

From: Yu Jiaoliang
Date: Tue Aug 20 2024 - 02:43:06 EST


Let the kememdup_array() take care about multiplication and possible overflows.
Signed-off-by: Yu Jiaoliang <yujiaoliang@xxxxxxxx>
---
drivers/hwtracing/intel_th/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index d72993355473..df72037c1c86 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -408,7 +408,7 @@ static int intel_th_device_add_resources(struct intel_th_device *thdev,
{
struct resource *r;

- r = kmemdup(res, sizeof(*res) * nres, GFP_KERNEL);
+ r = kmemdup_array(res, nres, sizeof(*res), GFP_KERNEL);
if (!r)
return -ENOMEM;

--
2.34.1