linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Marques <pmarques@grupopie.com>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kallsyms: fix potential overflow in binary search
Date: Wed, 14 May 2008 12:44:13 +0100	[thread overview]
Message-ID: <482AD08D.7070206@grupopie.com> (raw)
In-Reply-To: <20080513200736.GA17909@damson.getinternet.no>

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

  reply	other threads:[~2008-05-14 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-13 20:07 [PATCH] kallsyms: fix potential overflow in binary search Vegard Nossum
2008-05-14 11:44 ` Paulo Marques [this message]
2008-05-14 12:22   ` Pekka Enberg
2008-05-14 14:24     ` Paulo Marques
2008-05-14 15:31   ` Vegard Nossum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=482AD08D.7070206@grupopie.com \
    --to=pmarques@grupopie.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vegard.nossum@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).