1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
3 @@ -169,11 +169,12 @@ static int bcm47xxpart_parse(struct mtd_
4 * Assume that partitions end at the beginning of the one they are
7 - for (i = 0; i < curr_part - 1; i++)
8 - parts[i].size = parts[i + 1].offset - parts[i].offset;
10 - parts[curr_part - 1].size =
11 - master->size - parts[curr_part - 1].offset;
12 + for (i = 0; i < curr_part; i++) {
13 + u64 next_part_offset = (i < curr_part - 1) ?
14 + parts[i + 1].offset : master->size;
16 + parts[i].size = next_part_offset - parts[i].offset;