lkml.org 
[lkml]   [2008]   [May]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 14 May 2008 12:44:13 +0100
FromPaulo Marques <>
SubjectRe: [PATCH] kallsyms: fix potential overflow in binary search
Vegard Nossum wrote:
>>From 61b840f071e496f632fcc293f5435428cfc98844 Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <vegard.nossum@gmail.com>
> Date: Tue, 13 May 2008 10:20:27 +0200
> Subject: [PATCH] kallsyms: fix potential overflow in binary search
>
> This will probably never trigger... but it won't hurt to be careful.

Not "probably", this will never trigger _period_. If you ever have more
than 2^31 symbols in the kernel's kallsyms table you'll have worse
problems to worry about than the binary search overflowing.

So, I don't think it is worth this des-optimization at all...

> http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html
>
> Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
> ---
> kernel/kallsyms.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index 6fc0040..38fc10a 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


--
Paulo Marques - www.grupopie.com

Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration


\
 
 \ /
  Last update: 2008-05-14 13:47    [from the cache]
©2003-2009