mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Julien Thierry <jthierry@redhat.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mbenes@suse.cz
Subject: Re: [PATCH] objtool: Fix off-by-one in symbol_by_offset()
Date: Fri, 3 Apr 2020 09:50:44 -0500	[thread overview]
Message-ID: <20200403145044.fzdrywxbs7k6sq7p@treble> (raw)
In-Reply-To: <20200403131730.32618-1-jthierry@redhat.com>

On Fri, Apr 03, 2020 at 02:17:30PM +0100, Julien Thierry wrote:
> Sometimes, WARN_FUNC() and other users of symbol_by_offset() will
> associate the first instruction of a symbol with the symbol preceding
> it.
> This is because symbol->offset + symbol->len is already outside of the
> symbol's range.
> 
> Signed-off-by: Julien Thierry <jthierry@redhat.com>
> ---
>  tools/objtool/elf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
> index 09ddc8f1def3..c4857fa3f1d1 100644
> --- a/tools/objtool/elf.c
> +++ b/tools/objtool/elf.c
> @@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node)
>  
>  	if (*o < s->offset)
>  		return -1;
> -	if (*o > s->offset + s->len)
> +	if (*o >= s->offset + s->len)
>  		return 1;
>  
>  	return 0;

Thanks - looks like this fixes 2a362ecc3ec9 ("objtool: Optimize
find_symbol_*() and read_symbols()").

-- 
Josh


  reply	other threads:[~2020-04-03 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 13:17 Julien Thierry
2020-04-03 14:50 ` Josh Poimboeuf [this message]
2020-04-06  9:11 ` Miroslav Benes
2020-04-14 12:53 Josh Poimboeuf

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=20200403145044.fzdrywxbs7k6sq7p@treble \
    --to=jpoimboe@redhat.com \
    --cc=jthierry@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®