Re: [PATCH v2] mtd: blktrans: fix multiplication overflow

2015-09-28 Thread Brian Norris
On Fri, Sep 11, 2015 at 09:41:47PM +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 v2] mtd: blktrans: fix multiplication overflow

2015-09-11 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