]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ENGR00232005 mtd: fix the overflow of big mtd partitions
authorHuang Shijie <b32955@freescale.com>
Thu, 1 Nov 2012 06:23:25 +0000 (14:23 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:39 +0000 (08:35 +0200)
commitd66f6c8182278110672f90254969b32c32a7f420
tree9c8527d465ddde614b70c5d09c195beb411ca7a9
parentfd32aff6edca4167a724125ffd7823b7ce821456
ENGR00232005 mtd: fix the overflow of big mtd partitions

When the kernel parses the following cmdline

#mtdparts=gpmi-nand:16m(boot),16m(kernel),1g(home),4g(test),-(usr)

for a big nand chip Micron MT29F64G08AFAAAWP(8GB), we got the following wrong
result:

.............................................
"mtd: partition size too small (0)"
.............................................

We can not get any partition.

The "4g(test)" partition triggers a overflow of the "size". The memparse()
returns 4g to the "size", but the size is "unsigned long" type, so a overflow
occurs, the "size" becomes zero in the end.

This patch changes the "size"/"offset" to "unsigned long long" type,
and replaces the UINT_MAX with ULLONG_MAX for macros SIZE_REMAINING and
OFFSET_CONTINUOUS.

Signed-off-by: Huang Shijie <b32955@freescale.com>
drivers/mtd/cmdlinepart.c