VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> 2020-01-11 18:44:34 +0530 committer: Michal Simek <michal.simek@xilinx.com> 2020-02-04 11:38:59 +0100 commit: 061d2c1d593076424c910cb1b64ecdb5c9a6923f parent: 2602276d3d3811b1a48c48113042cd75fcbfc27d
Commit Summary:
microblaze: Prevent the overflow of the start
Diffstat:
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)