[PATCH] libkmod-config: Only match dot before '=' in /proc/cmdline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux