mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
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
This commit is contained in:
parent
e334c01df2
commit
175086cf4a
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user