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