projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18af7e3
)
mtd: maps: physmap-core: fix flash size larger than 32-bit
author
Baruch Siach
<baruch@tkos.co.il>
Thu, 8 Feb 2024 10:34:18 +0000
(12:34 +0200)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Mon, 26 Feb 2024 10:26:21 +0000
(11:26 +0100)
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
drivers/mtd/maps/physmap-core.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/maps/physmap-core.c
b/drivers/mtd/maps/physmap-core.c
index 746a27d15d44006c810edc186ee1cdaffc4a2907..96eb2e782c382644273e63fc58ea4f7bf0648fcd 100644
(file)
--- a/
drivers/mtd/maps/physmap-core.c
+++ b/
drivers/mtd/maps/physmap-core.c
@@
-518,7
+518,7
@@
static int physmap_flash_probe(struct platform_device *dev)
if (!info->maps[i].phys)
info->maps[i].phys = res->start;
- info->win_order =
get_bitmask_order
(resource_size(res)) - 1;
+ info->win_order =
fls64
(resource_size(res)) - 1;
info->maps[i].size = BIT(info->win_order +
(info->gpios ?
info->gpios->ndescs : 0));