projects
/
linux-2.6-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e334c01
)
mtd: concat: Use kmemdup_array instead of kmemdup for multiple allocation
author
Yan Zhen
<yanzhen@vivo.com>
Fri, 23 Aug 2024 11:08:24 +0000
(19:08 +0800)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Fri, 23 Aug 2024 17:25:51 +0000
(19:25 +0200)
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
drivers/mtd/mtdconcat.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/mtd/mtdconcat.c
b/drivers/mtd/mtdconcat.c
index 193428de6a4bdfc324bd7c985ec7ebda28a658e6..f56f44aa8625ce27efe5f806a82ff89aec558e1a 100644
(file)
--- 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;