[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <e24752dd9ea739c86bca9cfe79f7f29b0afa0182.1579005255.git.michal.simek@xilinx.com>
Date: Tue, 14 Jan 2020 13:34:17 +0100
From: Michal Simek <michal.simek@...inx.com>
To: linux-kernel@...r.kernel.org, monstr@...str.eu,
michal.simek@...inx.com, git@...inx.com
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>
Subject: [PATCH] microblaze: Prevent the overflow of the start
From: Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>
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@...inx.com>
Signed-off-by: Michal Simek <michal.simek@...inx.com>
---
arch/microblaze/kernel/cpu/cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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)
--
2.24.0
Powered by blists - more mailing lists