mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Jessica Yu <jeyu@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kallsyms: Use bounded strnchr() when parsing string
Date: Mon, 24 Apr 2017 11:12:00 +0900	[thread overview]
Message-ID: <20170424111200.8fe9ea1667b433709b265a1b@kernel.org> (raw)
In-Reply-To: <20170423172343.12739-1-naveen.n.rao@linux.vnet.ibm.com>

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>

  reply	other threads:[~2017-04-24  2:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 17:23 Naveen N. Rao
2017-04-24  2:12 ` Masami Hiramatsu [this message]
2017-04-24 21:27 ` Jessica Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170424111200.8fe9ea1667b433709b265a1b@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=jeyu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®