mtd: spi-nor: sfdp: Fix wrong erase type bitmask for overlaid region
authorTakahiro Kuwano <Takahiro.Kuwano@infineon.com>
Fri, 2 Oct 2020 05:17:59 +0000 (14:17 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:37 +0000 (11:38 +0100)
commitc27cf85cd931591a782f04467a9776f55486f6e3
tree38dbcce446b6e7c22fee495393aa65f8ed468aef
parentc123b069bbb24ae0a7b64048cc7a94a0e3b20ba0
mtd: spi-nor: sfdp: Fix wrong erase type bitmask for overlaid region

commit abdf5a5ef9652bad4d58058bc22ddf23543ba3e1 upstream.

At the time spi_nor_region_check_overlay() is called, the erase types are
sorted in ascending order of erase size. The 'erase_type' should be masked
with 'BIT(erase[i].idx)' instead of 'BIT(i)'.

Fixes: b038e8e3be72 ("mtd: spi-nor: parse SFDP Sector Map Parameter Table")
Cc: stable@vger.kernel.org
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
[ta: Add Fixes tag and Cc to stable]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/fd90c40d5b626a1319a78fc2bcee79a8871d4d57.1601612872.git.Takahiro.Kuwano@infineon.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/spi-nor/sfdp.c