Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-09 Thread Brian Norris
On Sat, Sep 05, 2015 at 09:42:27PM +0800, Peng Fan wrote: > On Wed, Sep 02, 2015 at 10:02:49AM -0700, Brian Norris wrote: > > One possibility, since you only point to a single computation that > > overflows, is to just fix the overflow locally. It's not like the 'size' > > (which represents number

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-09 Thread Brian Norris
On Sat, Sep 05, 2015 at 09:42:27PM +0800, Peng Fan wrote: > On Wed, Sep 02, 2015 at 10:02:49AM -0700, Brian Norris wrote: > > One possibility, since you only point to a single computation that > > overflows, is to just fix the overflow locally. It's not like the 'size' > > (which represents number

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-05 Thread Peng Fan
On Wed, Sep 02, 2015 at 10:02:49AM -0700, Brian Norris wrote: > On Fri, Aug 21, 2015 at 10:57:31PM +0800, Peng Fan wrote: > > In drivers/mtd/mtd_blkdevs.c: > > 406 set_capacity(gd, (new->size * tr->blksize) >> 9); > > The type of new->size is unsigned long and the type of tr->blksize is int, > >

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-05 Thread Peng Fan
On Wed, Sep 02, 2015 at 10:02:49AM -0700, Brian Norris wrote: > On Fri, Aug 21, 2015 at 10:57:31PM +0800, Peng Fan wrote: > > In drivers/mtd/mtd_blkdevs.c: > > 406 set_capacity(gd, (new->size * tr->blksize) >> 9); > > The type of new->size is unsigned long and the type of tr->blksize is int, > >

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-02 Thread Brian Norris
On Fri, Aug 21, 2015 at 10:57:31PM +0800, Peng Fan wrote: > In drivers/mtd/mtd_blkdevs.c: > 406 set_capacity(gd, (new->size * tr->blksize) >> 9); > The type of new->size is unsigned long and the type of tr->blksize is int, > the result of 'new->size * tr->blksize' may exceed ULONG_MAX on 32bit >

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-02 Thread Brian Norris
On Fri, Aug 21, 2015 at 10:57:31PM +0800, Peng Fan wrote: > In drivers/mtd/mtd_blkdevs.c: > 406 set_capacity(gd, (new->size * tr->blksize) >> 9); > The type of new->size is unsigned long and the type of tr->blksize is int, > the result of 'new->size * tr->blksize' may exceed ULONG_MAX on 32bit >

[PATCH] mtd: blktrans: fix integer overflow

2015-08-21 Thread Peng Fan
In drivers/mtd/mtd_blkdevs.c: 406 set_capacity(gd, (new->size * tr->blksize) >> 9); The type of new->size is unsigned long and the type of tr->blksize is int, the result of 'new->size * tr->blksize' may exceed ULONG_MAX on 32bit machines. I use nand chip MT29F32G08CBADBWP which is 4GB and the

[PATCH] mtd: blktrans: fix integer overflow

2015-08-21 Thread Peng Fan
In drivers/mtd/mtd_blkdevs.c: 406 set_capacity(gd, (new-size * tr-blksize) 9); The type of new-size is unsigned long and the type of tr-blksize is int, the result of 'new-size * tr-blksize' may exceed ULONG_MAX on 32bit machines. I use nand chip MT29F32G08CBADBWP which is 4GB and the