Commit 2fc9c4e1 authored by Vegard Nossum's avatar Vegard Nossum Committed by Linus Torvalds

kallsyms: fix potential overflow in binary search

This will probably never trigger... but it won't hurt to be careful.

http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.htmlSigned-off-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
Cc: Joshua Bloch <jjb@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58340a07
...@@ -176,7 +176,7 @@ static unsigned long get_symbol_pos(unsigned long addr, ...@@ -176,7 +176,7 @@ static unsigned long get_symbol_pos(unsigned long addr,
high = kallsyms_num_syms; high = kallsyms_num_syms;
while (high - low > 1) { while (high - low > 1) {
mid = (low + high) / 2; mid = low + (high - low) / 2;
if (kallsyms_addresses[mid] <= addr) if (kallsyms_addresses[mid] <= addr)
low = mid; low = mid;
else else
......
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