* [PATCH] mtd: change len type from signed to unsigned type [not found] <CGME20180823084348eucas1p2157ab1089290298cf43647e522b8be4f@eucas1p2.samsung.com> @ 2018-08-23 8:43 ` Huijin Park 2018-10-31 14:02 ` Boris Brezillon 0 siblings, 1 reply; 4+ messages in thread From: Huijin Park @ 2018-08-23 8:43 UTC (permalink / raw) To: Boris Brezillon Cc: Marek Vasut, linux-mtd, linux-kernel, Huijin Park, bbanghj.park 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'. 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 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) { struct erase_info erase; size_t retlen; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: change len type from signed to unsigned type 2018-08-23 8:43 ` [PATCH] mtd: change len type from signed to unsigned type Huijin Park @ 2018-10-31 14:02 ` Boris Brezillon 2018-11-12 16:27 ` Huijin Park 0 siblings, 1 reply; 4+ messages in thread From: Boris Brezillon @ 2018-10-31 14:02 UTC (permalink / raw) To: Huijin Park; +Cc: Marek Vasut, linux-mtd, linux-kernel, bbanghj.park 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; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: change len type from signed to unsigned type 2018-10-31 14:02 ` Boris Brezillon @ 2018-11-12 16:27 ` Huijin Park 0 siblings, 0 replies; 4+ messages in thread From: Huijin Park @ 2018-11-12 16:27 UTC (permalink / raw) To: boris.brezillon; +Cc: huijin.park, marek.vasut, linux-mtd, linux-kernel Hi Boris, On Wed, Oct 31, 2018 at 11:02 PM Boris Brezillon <boris.brezillon@bootlin.com> wrote: > > 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. It's my mistake. Messages about u64 are not related to this patch. > > > 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; > I will send again patch after reword the commit message. Thanks & best regards, Huijin ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CGME20181113051718eucas1p22fafec2dc4d5ea4eedb3686f6d566fad@eucas1p2.samsung.com>]
* [PATCH] mtd: change len type from signed to unsigned type [not found] <CGME20181113051718eucas1p22fafec2dc4d5ea4eedb3686f6d566fad@eucas1p2.samsung.com> @ 2018-11-13 5:16 ` Huijin Park 0 siblings, 0 replies; 4+ messages in thread From: Huijin Park @ 2018-11-13 5:16 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
end of thread, other threads:[~2018-11-13 5:17 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [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 2018-11-12 16:27 ` Huijin Park [not found] <CGME20181113051718eucas1p22fafec2dc4d5ea4eedb3686f6d566fad@eucas1p2.samsung.com> 2018-11-13 5:16 ` Huijin Park
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).