* [PATCH] kallsyms: Use bounded strnchr() when parsing string
@ 2017-04-23 17:23 Naveen N. Rao
2017-04-24 2:12 ` Masami Hiramatsu
2017-04-24 21:27 ` Jessica Yu
0 siblings, 2 replies; 3+ messages in thread
From: Naveen N. Rao @ 2017-04-23 17:23 UTC (permalink / raw)
To: Jessica Yu, Rusty Russell
Cc: Michael Ellerman, Masami Hiramatsu, linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kallsyms: Use bounded strnchr() when parsing string
2017-04-23 17:23 [PATCH] kallsyms: Use bounded strnchr() when parsing string Naveen N. Rao
@ 2017-04-24 2:12 ` Masami Hiramatsu
2017-04-24 21:27 ` Jessica Yu
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2017-04-24 2:12 UTC (permalink / raw)
To: Naveen N. Rao
Cc: Jessica Yu, Rusty Russell, Michael Ellerman, Masami Hiramatsu,
linux-kernel
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kallsyms: Use bounded strnchr() when parsing string
2017-04-23 17:23 [PATCH] kallsyms: Use bounded strnchr() when parsing string Naveen N. Rao
2017-04-24 2:12 ` Masami Hiramatsu
@ 2017-04-24 21:27 ` Jessica Yu
1 sibling, 0 replies; 3+ messages in thread
From: Jessica Yu @ 2017-04-24 21:27 UTC (permalink / raw)
To: Naveen N. Rao
Cc: Rusty Russell, Michael Ellerman, Masami Hiramatsu, linux-kernel
+++ Naveen N. Rao [23/04/17 22:53 +0530]:
>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>
Applied, thanks!
Jessica
>---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-24 21:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-23 17:23 [PATCH] kallsyms: Use bounded strnchr() when parsing string Naveen N. Rao
2017-04-24 2:12 ` Masami Hiramatsu
2017-04-24 21:27 ` Jessica Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).