summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>2017-04-23 22:53:43 +0530
committerJessica Yu <jeyu@redhat.com>2017-04-24 14:07:28 -0700
commit17586188276980ff10d1244a35aeb31ae199705e (patch)
tree4fdc895a54bacf3bede46dcd05886922ca79d44f /kernel
parent8ba4fcdf0f4068407e98cd9cc0f230c2dd8d56de (diff)
downloadlinux-17586188276980ff10d1244a35aeb31ae199705e.tar.gz
linux-17586188276980ff10d1244a35aeb31ae199705e.tar.bz2
linux-17586188276980ff10d1244a35aeb31ae199705e.zip
kallsyms: Use bounded strnchr() when parsing string
When parsing for the <module:name> format, we use strchr() to look for the separator, when we know that the module name can't be longer than MODULE_NAME_LEN. Enforce the same using strnchr(). Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Jessica Yu <jeyu@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 7eba6dea4f41..d3bd56ed3541 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4017,7 +4017,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
/* Don't lock: we're in enough trouble already. */
preempt_disable();
- if ((colon = strchr(name, ':')) != NULL) {
+ if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) {
if ((mod = find_module_all(name, colon - name, false)) != NULL)
ret = mod_find_symname(mod, colon+1);
} else {