public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: change len type from signed to unsigned type
       [not found] <CGME20181115050724eucas1p169b2046c03e108035199a4481a82a560@eucas1p1.samsung.com>
@ 2018-11-15  5:07 ` Huijin Park
  2018-11-15  9:29   ` Miquel Raynal
  2018-11-15 13:34   ` Boris Brezillon
  0 siblings, 2 replies; 4+ messages in thread
From: Huijin Park @ 2018-11-15  5:07 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Marek Vasut, linux-mtd, linux-kernel, Huijin Park, bbanghj.park

From: "huijin.park" <huijin.park@samsung.com>

This patch casts the "len" parameter to an unsigned int.
The callers of erase_write() pass the "len" parameter as unsigned int.

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)
 {
 	struct erase_info erase;
 	size_t retlen;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mtd: change len type from signed to unsigned type
  2018-11-15  5:07 ` [PATCH v2] mtd: change len type from signed to unsigned type Huijin Park
@ 2018-11-15  9:29   ` Miquel Raynal
  2018-11-28 14:51     ` Huijin Park
  2018-11-15 13:34   ` Boris Brezillon
  1 sibling, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2018-11-15  9:29 UTC (permalink / raw)
  To: Huijin Park
  Cc: Boris Brezillon, Marek Vasut, linux-mtd, linux-kernel,
	bbanghj.park

Hi Huijin,

Huijin Park <huijin.park@samsung.com> wrote on Thu, 15 Nov 2018
00:07:10 -0500:

> From: "huijin.park" <huijin.park@samsung.com>
> 
> This patch casts the "len" parameter to an unsigned int.
> The callers of erase_write() pass the "len" parameter as unsigned int.

Indeed. Perhaps it is worth backporting this patch to a stable releases?

> 
> 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)
>  {
>  	struct erase_info erase;
>  	size_t retlen;

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>


Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mtd: change len type from signed to unsigned type
  2018-11-15  5:07 ` [PATCH v2] mtd: change len type from signed to unsigned type Huijin Park
  2018-11-15  9:29   ` Miquel Raynal
@ 2018-11-15 13:34   ` Boris Brezillon
  1 sibling, 0 replies; 4+ messages in thread
From: Boris Brezillon @ 2018-11-15 13:34 UTC (permalink / raw)
  To: Huijin Park; +Cc: Marek Vasut, linux-mtd, linux-kernel, bbanghj.park

On Thu, 15 Nov 2018 00:07:10 -0500
Huijin Park <huijin.park@samsung.com> wrote:

> From: "huijin.park" <huijin.park@samsung.com>
> 
> This patch casts the "len" parameter to an unsigned int.

Hm, that's not really what this patch actually. Actually it avoids the
cast from an int to an unsigned int.

> The callers of erase_write() pass the "len" parameter as unsigned int.

That's the important part here. Callers of erase_write() always pass an
unsigned int, so what you're trying to do here is avoid a cast to an
int.

> 
> Signed-off-by: huijin.park <huijin.park@samsung.com>
> ---

You should have a changelog here.

>  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)
>  {
>  	struct erase_info erase;
>  	size_t retlen;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mtd: change len type from signed to unsigned type
  2018-11-15  9:29   ` Miquel Raynal
@ 2018-11-28 14:51     ` Huijin Park
  0 siblings, 0 replies; 4+ messages in thread
From: Huijin Park @ 2018-11-28 14:51 UTC (permalink / raw)
  To: miquel.raynal
  Cc: huijin.park, boris.brezillon, Marek Vašut, linux-mtd,
	linux-kernel

Hi Miquèl,

On Thu, Nov 15, 2018 at 6:29 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Huijin,
>
> Huijin Park <huijin.park@samsung.com> wrote on Thu, 15 Nov 2018
> 00:07:10 -0500:
>
> > From: "huijin.park" <huijin.park@samsung.com>
> >
> > This patch casts the "len" parameter to an unsigned int.
> > The callers of erase_write() pass the "len" parameter as unsigned int.
>
> Indeed. Perhaps it is worth backporting this patch to a stable releases?
>

It doesn't need backporting.
Because this patch is for enforcing code correctness.

> >
> > 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)
> >  {
> >       struct erase_info erase;
> >       size_t retlen;
>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
>
>
> Thanks,
> Miquèl

Thanks,
Huijin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-28 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20181115050724eucas1p169b2046c03e108035199a4481a82a560@eucas1p1.samsung.com>
2018-11-15  5:07 ` [PATCH v2] mtd: change len type from signed to unsigned type Huijin Park
2018-11-15  9:29   ` Miquel Raynal
2018-11-28 14:51     ` Huijin Park
2018-11-15 13:34   ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox