From: Vegard Nossum Date: Fri, 25 Jul 2008 08:45:34 +0000 (-0700) Subject: kallsyms: fix potential overflow in binary search X-Git-Tag: v2.6.27-rc1~485 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fc9c4e18f94431e7eb77d97edb2a995b46fba55;p=linux-2.6 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.html Signed-off-by: Vegard Nossum Cc: Joshua Bloch Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 6fc0040f3e..38fc10ac75 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -176,7 +176,7 @@ static unsigned long get_symbol_pos(unsigned long addr, high = kallsyms_num_syms; while (high - low > 1) { - mid = (low + high) / 2; + mid = low + (high - low) / 2; if (kallsyms_addresses[mid] <= addr) low = mid; else