[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158929422079.390.2344803808606534510.tip-bot2@tip-bot2>
Date: Tue, 12 May 2020 14:37:00 -0000
From: "tip-bot2 for Will Deacon" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
"David S. Miller" <davem@...emloft.net>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: locking/kcsan] sparc32: mm: Fix argument checking in
__srmmu_get_nocache()
The following commit has been merged into the locking/kcsan branch of tip:
Commit-ID: f790d0205fd5bd646bbc219211903a2aa164da97
Gitweb: https://git.kernel.org/tip/f790d0205fd5bd646bbc219211903a2aa164da97
Author: Will Deacon <will@...nel.org>
AuthorDate: Mon, 11 May 2020 21:41:33 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 12 May 2020 11:04:08 +02:00
sparc32: mm: Fix argument checking in __srmmu_get_nocache()
The 'size' argument to __srmmu_get_nocache() is a number of bytes not
a shift value, so fix up the sanity checking to treat it properly.
Signed-off-by: Will Deacon <will@...nel.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: "David S. Miller" <davem@...emloft.net>
Link: https://lkml.kernel.org/r/20200511204150.27858-2-will@kernel.org
---
arch/sparc/mm/srmmu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index b7c94de..cb9ded8 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -175,18 +175,18 @@ pte_t *pte_offset_kernel(pmd_t *dir, unsigned long address)
*/
static void *__srmmu_get_nocache(int size, int align)
{
- int offset;
+ int offset, minsz = 1 << SRMMU_NOCACHE_BITMAP_SHIFT;
unsigned long addr;
- if (size < SRMMU_NOCACHE_BITMAP_SHIFT) {
+ if (size < minsz) {
printk(KERN_ERR "Size 0x%x too small for nocache request\n",
size);
- size = SRMMU_NOCACHE_BITMAP_SHIFT;
+ size = minsz;
}
- if (size & (SRMMU_NOCACHE_BITMAP_SHIFT - 1)) {
- printk(KERN_ERR "Size 0x%x unaligned int nocache request\n",
+ if (size & (minsz - 1)) {
+ printk(KERN_ERR "Size 0x%x unaligned in nocache request\n",
size);
- size += SRMMU_NOCACHE_BITMAP_SHIFT - 1;
+ size += minsz - 1;
}
BUG_ON(align > SRMMU_NOCACHE_ALIGN_MAX);
Powered by blists - more mailing lists