projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7ad4b4a
)
kernel: avoid overflow in cmp_range
author
Louis Langholtz
<
[email protected]
>
Fri, 16 Jan 2015 05:04:46 +0000
(22:04 -0700)
committer
Linus Torvalds
<
[email protected]
>
Fri, 16 Jan 2015 21:02:23 +0000
(10:02 +1300)
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: Louis Langholtz <
[email protected]
>
Cc: Yinghai Lu <
[email protected]
>
Cc: Peter Anvin <
[email protected]
>
Cc: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
kernel/range.c
patch
|
blob
|
history
diff --git
a/kernel/range.c
b/kernel/range.c
index 322ea8e93e4ba36c11c0348a34c12e58c983da03..82cfc285b046d8e320559a48cf08007a19742dc0 100644
(file)
--- a/
kernel/range.c
+++ b/
kernel/range.c
@@
-113,12
+113,12
@@
static int cmp_range(const void *x1, const void *x2)
{
const struct range *r1 = x1;
const struct range *r2 = x2;
- s64 start1, start2;
- start1 = r1->start;
- start2 = r2->start;
-
- return start1 - start2;
+ if (r1->start < r2->start)
+ return -1;
+ if (r1->start > r2->start)
+ return 1;
+ return 0;
}
int clean_sort_range(struct range *range, int az)