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: <20241119235705.1576946-9-masahiroy@kernel.org>
Date: Wed, 20 Nov 2024 08:56:47 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: Masahiro Yamada <masahiroy@...nel.org>,
	Nathan Chancellor <nathan@...nel.org>,
	Nicolas Schier <nicolas@...sle.eu>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 09/15] modpost: convert do_pnp_device_entry() to a generic handler

do_pnp_device_entry() no longer needs to iterate over the
pnp_device_id array.

Convert it to a generic ->do_entry() handler.

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

 scripts/mod/file2alias.c | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index eabf702ef1a2..2bb9796a30be 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -625,27 +625,16 @@ static void do_acpi_entry(struct module *mod, void *symval)
 }
 
 /* looks like: "pnp:dD" */
-static void do_pnp_device_entry(void *symval, unsigned long size,
-				struct module *mod)
+static void do_pnp_device_entry(struct module *mod, void *symval)
 {
-	const unsigned long id_size = SIZE_pnp_device_id;
-	const unsigned int count = (size / id_size)-1;
-	unsigned int i;
+	DEF_FIELD_ADDR(symval, pnp_device_id, id);
+	char acpi_id[sizeof(*id)];
 
-	device_id_check(mod->name, "pnp", size, id_size, symval);
-
-	for (i = 0; i < count; i++) {
-		DEF_FIELD_ADDR(symval + i*id_size, pnp_device_id, id);
-		char acpi_id[sizeof(*id)];
-		int j;
-
-		module_alias_printf(mod, false, "pnp:d%s*", *id);
-
-		/* fix broken pnp bus lowercasing */
-		for (j = 0; j < sizeof(acpi_id); j++)
-			acpi_id[j] = toupper((*id)[j]);
-		module_alias_printf(mod, false, "acpi*:%s:*", acpi_id);
-	}
+	/* fix broken pnp bus lowercasing */
+	for (unsigned int i = 0; i < sizeof(acpi_id); i++)
+		acpi_id[i] = toupper((*id)[i]);
+	module_alias_printf(mod, false, "pnp:d%s*", *id);
+	module_alias_printf(mod, false, "acpi*:%s:*", acpi_id);
 }
 
 /* looks like: "pnp:dD" for every device of the card */
@@ -1529,6 +1518,7 @@ static const struct devtable devtable[] = {
 	{"cdx", SIZE_cdx_device_id, do_cdx_entry},
 	{"vchiq", SIZE_vchiq_device_id, do_vchiq_entry},
 	{"coreboot", SIZE_coreboot_device_id, do_coreboot_entry},
+	{"pnp", SIZE_pnp_device_id, do_pnp_device_entry},
 	{"pnp_card", SIZE_pnp_card_device_id, do_pnp_card_entry},
 };
 
@@ -1578,8 +1568,6 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_usb_table(symval, sym->st_size, mod);
 	else if (sym_is(name, namelen, "of"))
 		do_of_table(symval, sym->st_size, mod);
-	else if (sym_is(name, namelen, "pnp"))
-		do_pnp_device_entry(symval, sym->st_size, mod);
 	else {
 		int i;
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ