Commit 8283a979 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] exception table search fix

The exception table search code currently fails if addresses differ by more
than 2G.  This is only a problem when using the 4g/4g address space split,
but it's more robust this way.

Also, shuffle the comparison order n there so the least likely case comes
last.
parent fa85002b
......@@ -60,16 +60,18 @@ search_extable(const struct exception_table_entry *first,
{
while (first <= last) {
const struct exception_table_entry *mid;
long diff;
mid = (last - first) / 2 + first;
diff = mid->insn - value;
if (diff == 0)
return mid;
if (diff < 0)
first = mid+1;
/*
* careful, the distance between entries can be
* larger than 2GB:
*/
if (mid->insn < value)
first = mid + 1;
else if (mid->insn > value)
last = mid - 1;
else
last = mid-1;
return mid;
}
return NULL;
}
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