[PATCH v1] mtd:concat:Switch to use kmemdup_array()
Yan Zhen
yanzhen at vivo.com
Fri Aug 23 01:25:35 PDT 2024
When we are allocating an array,
using kmemdup_array() is more appropriate
and makes auditing the code easier.
Signed-off-by: Yan Zhen <yanzhen at vivo.com>
---
drivers/mtd/mtdconcat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 193428de6a4b..f56f44aa8625 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -204,7 +204,7 @@ concat_writev(struct mtd_info *mtd, const struct kvec *vecs,
}
/* make a copy of vecs */
- vecs_copy = kmemdup(vecs, sizeof(struct kvec) * count, GFP_KERNEL);
+ vecs_copy = kmemdup_array(vecs, count, sizeof(struct kvec), GFP_KERNEL);
if (!vecs_copy)
return -ENOMEM;
--
2.34.1
More information about the linux-mtd
mailing list