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]
Message-Id: <20231101150404.754108-4-masahiroy@kernel.org>
Date:   Thu,  2 Nov 2023 00:04:00 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     linux-kbuild@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, Greg Ungerer <gerg@...nel.org>,
        Jack Brennen <jbrennen@...gle.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nicolas Schier <nicolas@...sle.eu>
Subject: [PATCH 3/7] modpost: add table_size local variable to symsearch_find_nearest()

Keep consistency with 'table', and make the conditional part slightly
shorter.

Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---

 scripts/mod/symsearch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/mod/symsearch.c b/scripts/mod/symsearch.c
index 00f0f9c354db..97566aee0979 100644
--- a/scripts/mod/symsearch.c
+++ b/scripts/mod/symsearch.c
@@ -154,9 +154,10 @@ Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
 				unsigned int secndx, bool allow_negative,
 				Elf_Addr min_distance)
 {
-	unsigned int hi = elf->symsearch->table_size;
-	unsigned int lo = 0;
 	const struct syminfo *table = elf->symsearch->table;
+	unsigned int table_size = elf->symsearch->table_size;
+	unsigned int hi = table_size;
+	unsigned int lo = 0;
 	struct syminfo target;
 
 	target.addr = addr;
@@ -183,8 +184,7 @@ Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
 	 */
 	Elf_Sym *result = NULL;
 
-	if (allow_negative &&
-	    hi < elf->symsearch->table_size &&
+	if (allow_negative && hi < table_size &&
 	    table[hi].section_index == secndx &&
 	    table[hi].addr - addr <= min_distance) {
 		min_distance = table[hi].addr - addr;
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ