microblaze: Prevent the overflow of the start

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>
This commit is contained in:
Shubhrajyoti Datta 2020-01-11 18:44:34 +05:30 committed by Michal Simek
parent 2602276d3d
commit 061d2c1d59
1 changed files with 2 additions and 1 deletions

View File

@ -92,6 +92,7 @@ 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); \
if (start < UINT_MAX - cache_size) \
end = min(start + cache_size, end); \
start &= align; \
} while (0)