Discussion:
[PATCH] libkmod-config: Only match dot before '=' in /proc/cmdline
Michal Marek
2014-03-05 12:27:41 UTC
Permalink
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
Lucas De Marchi
2014-03-05 15:30:06 UTC
Permalink
Hi,
Post by Michal Marek
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.
---
Applied.

Since you already touched the testsuite in previous patches, could you
add tests for these, too?

Thanks
Lucas De Marchi
Lucas De Marchi
2014-03-06 14:03:51 UTC
Permalink
Hi,

On Wed, Mar 5, 2014 at 12:30 PM, Lucas De Marchi
Post by Lucas De Marchi
Hi,
Post by Michal Marek
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.
---
Applied.
Since you already touched the testsuite in previous patches, could you
add tests for these, too?
So... I went ahead and added some tests that I'm sending to the ML.
could you take a look?

thanks
Lucas De Marchi
Michal Marek
2014-03-06 17:00:46 UTC
Permalink
Post by Lucas De Marchi
Hi,
On Wed, Mar 5, 2014 at 12:30 PM, Lucas De Marchi
Post by Lucas De Marchi
Hi,
Post by Michal Marek
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.
---
Applied.
Since you already touched the testsuite in previous patches, could you
add tests for these, too?
So... I went ahead and added some tests that I'm sending to the ML.
could you take a look?
Thanks, I will have a look later. I was chasing another testsuite bug
this afternoon. Will send the patch soon.

Michal

Loading...