Commit fc7f0dd3 authored by Louis Langholtz's avatar Louis Langholtz Committed by Linus Torvalds

kernel: avoid overflow in cmp_range

Avoid overflow possibility.

[ The overflow is purely theoretical, since this is used for memory
  ranges that aren't even close to using the full 64 bits, but this is
  the right thing to do regardless.  - Linus ]
Signed-off-by: default avatarLouis Langholtz <lou_langholtz@me.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Peter Anvin <hpa@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7ad4b4ae
...@@ -113,12 +113,12 @@ static int cmp_range(const void *x1, const void *x2) ...@@ -113,12 +113,12 @@ static int cmp_range(const void *x1, const void *x2)
{ {
const struct range *r1 = x1; const struct range *r1 = x1;
const struct range *r2 = x2; const struct range *r2 = x2;
s64 start1, start2;
start1 = r1->start; if (r1->start < r2->start)
start2 = r2->start; return -1;
if (r1->start > r2->start)
return start1 - start2; return 1;
return 0;
} }
int clean_sort_range(struct range *range, int az) int clean_sort_range(struct range *range, int az)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment