Skip to content

Commit

Permalink
microblaze: Prevent the overflow of the start
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shubhrajyoti Datta authored and Michal Simek committed Feb 4, 2020
1 parent 2602276 commit 061d2c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/microblaze/kernel/cpu/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 061d2c1

Please sign in to comment.