Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1629053 > unrolled thread
| Started by | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| First post | 2017-04-23 19:30 +0200 |
| Last post | 2017-04-24 04:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] kallsyms: Use bounded strnchr() when parsing string "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-23 19:30 +0200
Re: [PATCH] kallsyms: Use bounded strnchr() when parsing string Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-24 04:20 +0200
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-04-23 19:30 +0200 |
| Subject | [PATCH] kallsyms: Use bounded strnchr() when parsing string |
| Message-ID | <tztuF-2XO-7@gated-at.bofh.it> |
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>
---
kernel/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 {
--
2.12.1
[toc] | [next] | [standalone]
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Date | 2017-04-24 04:20 +0200 |
| Message-ID | <tzBLz-we-3@gated-at.bofh.it> |
| In reply to | #1629053 |
On Sun, 23 Apr 2017 22:53:43 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> 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().
Looks good to me :)
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks,
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> kernel/module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 {
> --
> 2.12.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web