summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorYan Zhen <yanzhen@vivo.com>2024-08-23 13:08:24 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2024-08-23 19:25:51 +0200
commit175086cf4acdf4ccd3d7a6bb5c5231ececd6656b (patch)
tree55d44283b9dbab79a433eff78a0d69435a911d46 /drivers/mtd
parentmtd: parsers: bcm47xxpart: make read-only array possible_nvram_sizes static c... (diff)
downloadlinux-175086cf4acdf4ccd3d7a6bb5c5231ececd6656b.tar.xz
linux-175086cf4acdf4ccd3d7a6bb5c5231ececd6656b.zip
mtd: concat: Use kmemdup_array instead of kmemdup for multiple allocation
When we are allocating an array, using kmemdup_array() to take care about multiplication and possible overflows. Also it makes auditing the code easier. Signed-off-by: Yan Zhen <yanzhen@vivo.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240823110824.3895787-1-yanzhen@vivo.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdconcat.c2
1 files changed, 1 insertions, 1 deletions
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;