diff options
| author | Peng Fan <[email protected]> | 2015-09-11 21:41:47 +0800 |
|---|---|---|
| committer | Brian Norris <[email protected]> | 2015-09-28 17:23:21 -0700 |
| commit | 2ce401d56b36a7492b26646b94d1fe9194880a1a (patch) | |
| tree | 2ab0c5b5254b72e488c51cba6b0730c2b9b4cef6 /tools/perf/scripts/python/net_dropmonitor.py | |
| parent | 7446076e818814d3237b20a96112b44bdb3f8576 (diff) | |
mtd: blktrans: fix multiplication overflow
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 parameters passed
to kernel is 'mtdparts=gpmi-nand:-(user)', the whole nand chip will be
treated as a 4GB mtd partition. new->size is 0x800000 and tr->blksize is
0x200, 'new->size * tr->blksize' however is 0. This is what we do not want
to see.
Using type cast u64 to fix the multiplication overflow issue.
Signed-off-by: Peng Fan <[email protected]>
Cc: David Woodhouse <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/net_dropmonitor.py')
0 files changed, 0 insertions, 0 deletions