lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 15 Mar 2020 11:41:37 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     tglx@...utronix.de, linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [RFC][PATCH 09/16] objtool: Optimize find_symbol_*() and
 read_symbols()

On Thu, Mar 12, 2020 at 02:41:16PM +0100, Peter Zijlstra wrote:
>  struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset)
>  {
> -	struct symbol *sym;
> +	struct rb_node *node;
>  
> -	list_for_each_entry(sym, &sec->symbol_list, list)
> -		if (sym->type != STT_SECTION &&
> -		    sym->offset == offset)
> -			return sym;
> +	rb_for_each(&sec->symbol_tree, node, &offset, symbol_by_offset) {
> +		struct symbol *s = rb_entry(node, struct symbol, node);
> +
> +		if (s->offset != offset)
> +			continue;
> +
> +		if (s->type != STT_SECTION)
> +			return s;
> +	}

Can be simplified to:

		if (s->offset == offset && s->type != STT_SECTION)
			return s;

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ