]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: Make sure mtd->erasesize is valid even if the partition is of size 0
authorBoris Brezillon <bbrezillon@kernel.org>
Wed, 30 Jan 2019 11:55:52 +0000 (12:55 +0100)
committerBoris Brezillon <bbrezillon@kernel.org>
Tue, 5 Feb 2019 23:02:51 +0000 (00:02 +0100)
commit3b313fb4b6bae8ca5a49e1b39590c2a8b0960736
tree528a506354beb97de16e105d81babf3d3ad813d2
parentd8a8d5bf2fbcd5c07022591a0bbb85ca32d3c8ed
mtd: Make sure mtd->erasesize is valid even if the partition is of size 0

Commit 9921747a2c43 ("mtd: Do not allow MTD devices with inconsistent
erase properties") introduced a check to make sure ->erasesize and
->_erase values are consistent with the MTD_NO_ERASE flag.
This patch did not take the 0 bytes partition case into account which
can happen when the defined partition is outside the flash device memory
range. Fix that by setting the partition erasesize to the parent
erasesize.

Fixes: 9921747a2c43 ("mtd: Do not allow MTD devices with inconsistent erase properties")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: <stable@vger.kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/mtd/mtdpart.c