]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: maps: physmap-core: fix flash size larger than 32-bit
authorBaruch Siach <baruch@tkos.co.il>
Thu, 8 Feb 2024 10:34:18 +0000 (12:34 +0200)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:52 +0000 (18:19 -0400)
commit6853209fd36afa7bf596505b3e93787188efc828
tree9f1a3d84aceebaa67e43ba580ba752e95fd5a909
parente0cbea9a3c59865beb821e36f66b0b82f37c8b23
mtd: maps: physmap-core: fix flash size larger than 32-bit

[ Upstream commit 3884f03edd34887514a0865a80769cd5362d5c3b ]

mtd-ram can potentially be larger than 4GB. get_bitmask_order() uses
fls() that is not guaranteed to work with values larger than 32-bit.
Specifically on aarch64 fls() returns 0 when all 32 LSB bits are clear.
Use fls64() instead.

Fixes: ba32ce95cbd987 ("mtd: maps: Merge gpio-addr-flash.c into physmap-core.c")
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/9fbf3664ce00f8b07867f1011834015f21d162a5.1707388458.git.baruch@tkos.co.il
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/maps/physmap-core.c