Thread (7 messages) 7 messages, 2 authors, 2015-09-30

[PATCHv2 5/5] depmod: Don't fall back to uname on bad version

From: Laura Abbott <hidden>
Date: 2015-09-28 22:39:21
Subsystem: the rest · Maintainer: Linus Torvalds

Currently, if a value that doesn't match a kernel version
("%u.%u") is passed in, depmod silently falls back to
using uname. Rather than try and work around the caller passing
bad data, just exit out instead.
---
 tools/depmod.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 348735f..a585d47 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2476,7 +2476,11 @@ static int do_depmod(int argc, char *argv[])
 		}
 	}
 
-	if (optind < argc && is_version_number(argv[optind])) {
+	if (optind < argc) {
+		if (!is_version_number(argv[optind])) {
+			ERR("Bad version passed %s\n", argv[optind]);
+			goto cmdline_failed;
+		}
 		cfg.kversion = argv[optind];
 		optind++;
 	} else {
-- 
2.4.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help