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 ]
Unified · Split
| @@ -113,12 +113,12 @@ static int cmp_range(const void *x1, const void *x2) · 112 unmodified lines | ||
| 113 | 113 | { |
| 114 | 114 | const struct range *r1 = x1; |
| 115 | 115 | const struct range *r2 = x2; |
| 116 | − s64 start1, start2; | |
| 117 | 116 | |
| 118 | − start1 = r1->start; | |
| 119 | − start2 = r2->start; | |
| 120 | − | |
| 121 | − return start1 - start2; | |
| 117 | + if (r1->start < r2->start) | |
| 118 | + return -1; | |
| 119 | + if (r1->start > r2->start) | |
| 120 | + return 1; | |
| 121 | + return 0; | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | int clean_sort_range(struct range *range, int az) |