Discussion:
[PATCH] depmod: warn on invalid devname specification
Tom Gundersen
2013-09-09 18:01:01 UTC
Permalink
During the last merge window (3.12) a couple of modules gained devname
aliases, but without the necessary major and minor information. These were
then silently ignored when generating modules.devname.

Complain loudly to avoid such errors sneaking in undetected in the future:

depmod: ERROR: Module 'zram' has devname (zram) but lacks major and minor information. Ignoring.
depmod: ERROR: Module 'uhid' has devname (uhid) but lacks major and minor information. Ignoring.

Cc: Kay Sievers <kay-tD+***@public.gmane.org>
Cc: Lucas De Marchi <lucas.demarchi-***@public.gmane.org>
---
tools/depmod.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index 985cf3a..5855b2a 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2120,11 +2120,18 @@ static int output_devname(struct depmod *depmod, FILE *out)
minor = min;
}

- if (type != '\0' && devname != NULL) {
+ if (type != '\0' && devname != NULL)
+ break;
+ }
+
+ if (devname != NULL) {
+ if (type != '\0')
fprintf(out, "%s %s %c%u:%u\n", mod->modname,
devname, type, major, minor);
- break;
- }
+ else
+ ERR("Module '%s' has devname (%s) but "
+ "lacks major and minor information. "
+ "Ignoring.\n", mod->modname, devname);
}
}
--
1.8.4
Lucas De Marchi
2013-09-10 03:55:01 UTC
Permalink
Hi Tom,
Post by Tom Gundersen
During the last merge window (3.12) a couple of modules gained devname
aliases, but without the necessary major and minor information. These were
then silently ignored when generating modules.devname.
depmod: ERROR: Module 'zram' has devname (zram) but lacks major and minor information. Ignoring.
depmod: ERROR: Module 'uhid' has devname (uhid) but lacks major and minor information. Ignoring.
---
tools/depmod.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 985cf3a..5855b2a 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2120,11 +2120,18 @@ static int output_devname(struct depmod *depmod, FILE *out)
minor = min;
}
- if (type != '\0' && devname != NULL) {
+ if (type != '\0' && devname != NULL)
+ break;
+ }
+
+ if (devname != NULL) {
+ if (type != '\0')
fprintf(out, "%s %s %c%u:%u\n", mod->modname,
devname, type, major, minor);
- break;
- }
+ else
+ ERR("Module '%s' has devname (%s) but "
+ "lacks major and minor information. "
+ "Ignoring.\n", mod->modname, devname);
}
}
--
Patch has been applied. Thanks.

Lucas De Marchi

Loading...