summaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>2020-01-11 18:44:34 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-24 08:34:53 +0100
commit9598feb0859f891574dd36ec42b799347a6b71f5 (patch)
treef6e0f3a1062efeb637f43df57060d0ab5a567b84 /arch/microblaze
parentaf9be1a3b46eacded3cbc0dfeaca484dacebefd5 (diff)
downloadlinux-stable-9598feb0859f891574dd36ec42b799347a6b71f5.tar.gz
linux-stable-9598feb0859f891574dd36ec42b799347a6b71f5.tar.bz2
linux-stable-9598feb0859f891574dd36ec42b799347a6b71f5.zip
microblaze: Prevent the overflow of the start
[ Upstream commit 061d2c1d593076424c910cb1b64ecdb5c9a6923f ] In case the start + cache size is more than the max int the start overflows. Prevent the same. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/kernel/cpu/cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c
index 0bde47e4fa69..dcba53803fa5 100644
--- a/arch/microblaze/kernel/cpu/cache.c
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -92,7 +92,8 @@ static inline void __disable_dcache_nomsr(void)
#define CACHE_LOOP_LIMITS(start, end, cache_line_length, cache_size) \
do { \
int align = ~(cache_line_length - 1); \
- end = min(start + cache_size, end); \
+ if (start < UINT_MAX - cache_size) \
+ end = min(start + cache_size, end); \
start &= align; \
} while (0)