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

Yu Jiaoliang posted 1 patch 1 year, 5 months ago
drivers/hwtracing/intel_th/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] drivers:intel_th:Switch to use kmemdup_array()
Posted by Yu Jiaoliang 1 year, 5 months ago
Let the kememdup_array() take care about multiplication and possible overflows.
Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
---
 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