* [PATCH v1] mtd:concat:Switch to use kmemdup_array()
@ 2024-08-23 8:25 Yan Zhen
2024-08-23 8:39 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Yan Zhen @ 2024-08-23 8:25 UTC (permalink / raw)
To: vigneshr, miquel.raynal, richard
Cc: linux-mtd, linux-kernel, opensource.kernel, Yan Zhen
When we are allocating an array,
using kmemdup_array() is more appropriate
and makes auditing the code easier.
Signed-off-by: Yan Zhen <yanzhen@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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] mtd:concat:Switch to use kmemdup_array()
2024-08-23 8:25 [PATCH v1] mtd:concat:Switch to use kmemdup_array() Yan Zhen
@ 2024-08-23 8:39 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2024-08-23 8:39 UTC (permalink / raw)
To: Yan Zhen; +Cc: vigneshr, richard, linux-mtd, linux-kernel, opensource.kernel
Hi Yan,
yanzhen@vivo.com wrote on Fri, 23 Aug 2024 16:25:35 +0800:
> When we are allocating an array,
> using kmemdup_array() is more appropriate
> and makes auditing the code easier.
Why do you cap your lines at the insane limit of 40 chars?
Also you're missing spaces in the title after the ':'
s/Switch to use/Switch to/?
>
> Signed-off-by: Yan Zhen <yanzhen@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;
>
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-23 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23 8:25 [PATCH v1] mtd:concat:Switch to use kmemdup_array() Yan Zhen
2024-08-23 8:39 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox