public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Yan Zhen <yanzhen@vivo.com>
Cc: vigneshr@ti.com, richard@nod.at, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v1] mtd:concat:Switch to use kmemdup_array()
Date: Fri, 23 Aug 2024 10:39:38 +0200	[thread overview]
Message-ID: <20240823103938.4fad7ca3@xps-13> (raw)
In-Reply-To: <20240823082535.3419187-1-yanzhen@vivo.com>

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/

      reply	other threads:[~2024-08-23  8:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  8:25 [PATCH v1] mtd:concat:Switch to use kmemdup_array() Yan Zhen
2024-08-23  8:39 ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240823103938.4fad7ca3@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=opensource.kernel@vivo.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=yanzhen@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox