linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libkmod-config: Only match dot before '=' in /proc/cmdline
@ 2014-03-05 12:27 Michal Marek
  2014-03-05 15:30 ` Lucas De Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2014-03-05 12:27 UTC (permalink / raw)
  To: linux-modules

Otherwise, we also parse strings like

  BOOT_IMAGE=/boot/vmlinuz-3.12.12-57.g5f654cf-default

In practice, this is not a problem, because there is no module named
BOOT_IMAGE=/boot/vmlinuz-3. It just disturbs in modprobe -c output.
---
 libkmod/libkmod-config.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 4417871..9905d5e 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -523,7 +523,7 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
 {
 	char buf[KCMD_LINE_SIZE];
 	int fd, err;
-	char *p, *modname,  *param = NULL, *value = NULL;
+	char *p, *modname,  *param = NULL, *value = NULL, is_module = 1;
 
 	fd = open("/proc/cmdline", O_RDONLY|O_CLOEXEC);
 	if (fd < 0) {
@@ -544,9 +544,11 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
 		switch (*p) {
 		case ' ':
 			*p = '\0';
-			kcmdline_parse_result(config, modname, param, value);
+			if (is_module)
+				kcmdline_parse_result(config, modname, param, value);
 			param = value = NULL;
 			modname = p + 1;
+			is_module = 1;
 			break;
 		case '.':
 			if (param == NULL) {
@@ -557,12 +559,15 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
 		case '=':
 			if (param != NULL)
 				value = p + 1;
+			else
+				is_module = 0;
 			break;
 		}
 	}
 
 	*p = '\0';
-	kcmdline_parse_result(config, modname, param, value);
+	if (is_module)
+		kcmdline_parse_result(config, modname, param, value);
 
 	return 0;
 }
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-06 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 12:27 [PATCH] libkmod-config: Only match dot before '=' in /proc/cmdline Michal Marek
2014-03-05 15:30 ` Lucas De Marchi
2014-03-06 14:03   ` Lucas De Marchi
2014-03-06 17:00     ` Michal Marek

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).