From: Sasha Levin <sashal@kernel•org>
To: linux-kernel@vger•kernel.org, stable@vger•kernel.org
Cc: linuxppc-dev@lists•ozlabs.org, Sasha Levin <sashal@kernel•org>
Subject: [PATCH AUTOSEL 4.14 053/127] powerpc/book3s/32: fix number of bats in p/v_block_mapped()
Date: Fri, 22 Nov 2019 00:54:31 -0500 [thread overview]
Message-ID: <20191122055544.3299-52-sashal@kernel.org> (raw)
In-Reply-To: <20191122055544.3299-1-sashal@kernel.org>
From: Christophe Leroy <christophe.leroy@c-s•fr>
[ Upstream commit e93ba1b7eb5b188c749052df7af1c90821c5f320 ]
This patch fixes the loop in p_block_mapped() and v_block_mapped()
to scan the entire bat_addrs[] array.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s•fr>
Signed-off-by: Michael Ellerman <mpe@ellerman•id.au>
Signed-off-by: Sasha Levin <sashal@kernel•org>
---
arch/powerpc/mm/ppc_mmu_32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index 2a049fb8523d5..96c52271e9c2d 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -52,7 +52,7 @@ struct batrange { /* stores address ranges mapped by BATs */
phys_addr_t v_block_mapped(unsigned long va)
{
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)
return bat_addrs[b].phys + (va - bat_addrs[b].start);
return 0;
@@ -64,7 +64,7 @@ phys_addr_t v_block_mapped(unsigned long va)
unsigned long p_block_mapped(phys_addr_t pa)
{
int b;
- for (b = 0; b < 4; ++b)
+ for (b = 0; b < ARRAY_SIZE(bat_addrs); ++b)
if (pa >= bat_addrs[b].phys
&& pa < (bat_addrs[b].limit-bat_addrs[b].start)
+bat_addrs[b].phys)
--
2.20.1
next parent reply other threads:[~2019-11-22 6:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191122055544.3299-1-sashal@kernel.org>
2019-11-22 5:54 ` Sasha Levin [this message]
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 054/127] powerpc/xmon: fix dump_segments() Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 064/127] powerpc/perf: Fix unit_sel/cache_sel checks Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 065/127] powerpc/prom: fix early DEBUG messages Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 066/127] powerpc/mm: Make NULL pointer deferences explicit on bad page faults Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 067/127] powerpc/44x/bamboo: Fix PCI range Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 069/127] powerpc/powernv/eeh/npu: Fix uninitialized variables in opal_pci_eeh_freeze_status Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 076/127] powerpc/83xx: handle machine check caused by watchdog timer Sasha Levin
2019-11-22 5:54 ` [PATCH AUTOSEL 4.14 077/127] powerpc/pseries: Fix node leak in update_lmb_associativity_index() Sasha Levin
2019-11-22 5:55 ` [PATCH AUTOSEL 4.14 090/127] net/wan/fsl_ucc_hdlc: Avoid double free in ucc_hdlc_probe() Sasha Levin
2019-11-22 5:55 ` [PATCH AUTOSEL 4.14 126/127] powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191122055544.3299-52-sashal@kernel.org \
--to=sashal@kernel$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=stable@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox