linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	pmladek@suse.com, david@redhat.com, petr.pavlu@suse.com,
	prarit@redhat.com
Cc: christophe.leroy@csgroup.eu, song@kernel.org, mcgrof@kernel.org
Subject: [PATCH 02/12] module: rename next_string() to module_next_tag_pair()
Date: Sun, 19 Mar 2023 14:27:36 -0700	[thread overview]
Message-ID: <20230319212746.1783033-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20230319212746.1783033-1-mcgrof@kernel.org>

This makes it clearer what it is doing. While at it,
make it available to other code other than main.c.
This will be used in the subsequent patch and make
the changes easier to read.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 kernel/module/internal.h | 2 ++
 kernel/module/main.c     | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/module/internal.h b/kernel/module/internal.h
index e3883b7d4840..1fa2328636ec 100644
--- a/kernel/module/internal.h
+++ b/kernel/module/internal.h
@@ -96,6 +96,8 @@ long module_get_offset_and_type(struct module *mod, enum mod_mem_type type,
 char *module_flags(struct module *mod, char *buf, bool show_state);
 size_t module_flags_taint(unsigned long taints, char *buf);
 
+char *module_next_tag_pair(char *string, unsigned long *secsize);
+
 static inline void module_assert_mutex_or_preempt(void)
 {
 #ifdef CONFIG_LOCKDEP
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 1e739f534100..ebb5e6b92a48 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1017,7 +1017,7 @@ int try_to_force_load(struct module *mod, const char *reason)
 }
 
 /* Parse tag=value strings from .modinfo section */
-static char *next_string(char *string, unsigned long *secsize)
+char *module_next_tag_pair(char *string, unsigned long *secsize)
 {
 	/* Skip non-zero chars */
 	while (string[0]) {
@@ -1051,10 +1051,10 @@ static char *get_next_modinfo(const struct load_info *info, const char *tag,
 
 	if (prev) {
 		size -= prev - modinfo;
-		modinfo = next_string(prev, &size);
+		modinfo = module_next_tag_pair(prev, &size);
 	}
 
-	for (p = modinfo; p; p = next_string(p, &size)) {
+	for (p = modinfo; p; p = module_next_tag_pair(p, &size)) {
 		if (strncmp(p, tag, taglen) == 0 && p[taglen] == '=')
 			return p + taglen + 1;
 	}
-- 
2.39.1


  parent reply	other threads:[~2023-03-19 21:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 21:27 [PATCH 00/12] module: cleanup and call taints after is inserted Luis Chamberlain
2023-03-19 21:27 ` [PATCH 01/12] module: move get_modinfo() helpers all above Luis Chamberlain
2023-03-19 21:27 ` Luis Chamberlain [this message]
2023-03-19 21:27 ` [PATCH 03/12] module: add a for_each_modinfo_entry() Luis Chamberlain
2023-03-19 21:27 ` [PATCH 04/12] module: move early sanity checks into a helper Luis Chamberlain
2023-03-24 13:02   ` Petr Pavlu
2023-03-24 18:33     ` Luis Chamberlain
2023-03-19 21:27 ` [PATCH 05/12] module: move check_modinfo() early to early_mod_check() Luis Chamberlain
2023-03-19 21:27 ` [PATCH 06/12] module: rename set_license() to module_license_taint_check() Luis Chamberlain
2023-03-19 21:27 ` [PATCH 07/12] module: split taint work out of check_modinfo_livepatch() Luis Chamberlain
2023-03-19 21:27 ` [PATCH 08/12] module: split taint adding with info checking Luis Chamberlain
2023-03-19 21:27 ` [PATCH 09/12] module: move tainting until after a module hits our linked list Luis Chamberlain
2023-03-19 21:27 ` [PATCH 10/12] module: move signature taint to module_augment_kernel_taints() Luis Chamberlain
2023-03-19 21:27 ` [PATCH 11/12] module: converge taint work together Luis Chamberlain
2023-03-19 21:27 ` [PATCH 12/12] module: rename check_module_license_and_versions() to check_export_symbol_versions() Luis Chamberlain
2023-03-22 23:42 ` [PATCH 00/12] module: cleanup and call taints after is inserted Luis Chamberlain

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=20230319212746.1783033-3-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=pmladek@suse.com \
    --cc=prarit@redhat.com \
    --cc=song@kernel.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;
as well as URLs for NNTP newsgroup(s).