linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Huijin Park <huijin.park@samsung.com>
Cc: Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	bbanghj.park@gmail.com
Subject: Re: [PATCH] mtd: change len type from signed to unsigned type
Date: Wed, 31 Oct 2018 15:02:25 +0100	[thread overview]
Message-ID: <20181031150225.175ec1d4@bbrezillon> (raw)
In-Reply-To: <1535013819-1646-1-git-send-email-huijin.park@samsung.com>

Hi Huijin,

On Thu, 23 Aug 2018 04:43:39 -0400
Huijin Park <huijin.park@samsung.com> wrote:

> From: "huijin.park" <huijin.park@samsung.com>
> 
> assign of a signed value which has type 'int' to a variable of
> a bigger unsigned integer type 'uint64_t'.

Why are you mentioning u64? AFAICT, the len passed to erase_write() is
always an unsigned int.

> this is ok most of the time, but can lead to unexpectedly large
> resulting value if the original signed value is negative.
> in addtion, the callers of the erase_write() pass the len parameter

  ^In addition,

> as unsigned type.
> 
> Signed-off-by: huijin.park <huijin.park@samsung.com>
> ---
>  drivers/mtd/mtdblock.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
> index a5b1933..b2d5ed1 100644
> --- a/drivers/mtd/mtdblock.c
> +++ b/drivers/mtd/mtdblock.c
> @@ -56,7 +56,7 @@ struct mtdblk_dev {
>   */
>  
>  static int erase_write (struct mtd_info *mtd, unsigned long pos,
> -			int len, const char *buf)
> +			unsigned int len, const char *buf)

The diff looks good, but the commit message is not clear at all. Can
you reword it?

Thanks,

Boris

>  {
>  	struct erase_info erase;
>  	size_t retlen;

  reply	other threads:[~2018-10-31 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180823084348eucas1p2157ab1089290298cf43647e522b8be4f@eucas1p2.samsung.com>
2018-08-23  8:43 ` [PATCH] mtd: change len type from signed to unsigned type Huijin Park
2018-10-31 14:02   ` Boris Brezillon [this message]
2018-11-12 16:27     ` Huijin Park
     [not found] <CGME20181113051718eucas1p22fafec2dc4d5ea4eedb3686f6d566fad@eucas1p2.samsung.com>
2018-11-13  5:16 ` Huijin Park

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=20181031150225.175ec1d4@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=bbanghj.park@gmail.com \
    --cc=huijin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.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;
as well as URLs for NNTP newsgroup(s).