Commit dcafeb8e authored by Christophe Leroy's avatar Christophe Leroy Committed by Kleber Sacilotto de Souza

powerpc/book3s/32: fix number of bats in p/v_block_mapped()

BugLink: https://bugs.launchpad.net/bugs/1855313

[ Upstream commit e93ba1b7 ]

This patch fixes the loop in p_block_mapped() and v_block_mapped()
to scan the entire bat_addrs[] array.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent d9191abb
...@@ -52,7 +52,7 @@ struct batrange { /* stores address ranges mapped by BATs */ ...@@ -52,7 +52,7 @@ struct batrange { /* stores address ranges mapped by BATs */
phys_addr_t v_mapped_by_bats(unsigned long va) phys_addr_t v_mapped_by_bats(unsigned long va)
{ {
int b; int b;
for (b = 0; b < 4; ++b) for (b = 0; b < ARRAY_SIZE(bat_addrs); ++b)
if (va >= bat_addrs[b].start && va < bat_addrs[b].limit) if (va >= bat_addrs[b].start && va < bat_addrs[b].limit)
return bat_addrs[b].phys + (va - bat_addrs[b].start); return bat_addrs[b].phys + (va - bat_addrs[b].start);
return 0; return 0;
...@@ -64,7 +64,7 @@ phys_addr_t v_mapped_by_bats(unsigned long va) ...@@ -64,7 +64,7 @@ phys_addr_t v_mapped_by_bats(unsigned long va)
unsigned long p_mapped_by_bats(phys_addr_t pa) unsigned long p_mapped_by_bats(phys_addr_t pa)
{ {
int b; int b;
for (b = 0; b < 4; ++b) for (b = 0; b < ARRAY_SIZE(bat_addrs); ++b)
if (pa >= bat_addrs[b].phys if (pa >= bat_addrs[b].phys
&& pa < (bat_addrs[b].limit-bat_addrs[b].start) && pa < (bat_addrs[b].limit-bat_addrs[b].start)
+bat_addrs[b].phys) +bat_addrs[b].phys)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment