public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: xiyou.wangcong@gmail.com, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, gregkh@suse.de
Subject: Re: [PATCH] param_sysfs_builtin memchr argument fix
Date: Mon, 8 Oct 2007 09:13:54 -0700	[thread overview]
Message-ID: <20071008091354.30598ee4.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20071008071730.GA2979@darkstar.te-china.tietoenator.com>

On Mon, 8 Oct 2007 15:17:30 +0800 Dave Young wrote:

> Hi,
> Thanks for comment.
> fixed.
> 
> Regards
> dave
> -----
> 
> If memchr argument is longer than strlen(kp->name), there will be some
> weird result.

Just to clarify:  this was causing duplicate filenames in sysfs ?


> Signed-off-by: Dave Young <hidave.darkstar@gmail.com> 
> 
> ---
> kernel/params.c |    8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff -upr linux/kernel/params.c linux.new/kernel/params.c
> --- linux/kernel/params.c	2007-10-08 14:30:06.000000000 +0800
> +++ linux.new/kernel/params.c	2007-10-08 15:13:04.000000000 +0800
> @@ -592,11 +592,17 @@ static void __init param_sysfs_builtin(v
>  
>  	for (i=0; i < __stop___param - __start___param; i++) {
>  		char *dot;
> +		size_t kplen;
>  
>  		kp = &__start___param[i];
> +		kplen = strlen(kp->name);
>  
>  		/* We do not handle args without periods. */
> -		dot = memchr(kp->name, '.', MAX_KBUILD_MODNAME);
> +		if (kplen > MAX_KBUILD_MODNAME) {
> +			DEBUGP("kernel parameter %s is too long\n", kp->name);

how about
	kernel parameter name %s is too long
or
	kernel parameter name is too long: %s

(primary is addition of "name")

> +			continue;
> +		}
> +		dot = memchr(kp->name, '.', kplen);
>  		if (!dot) {
>  			DEBUGP("couldn't find period in %s\n", kp->name);
>  			continue;
> -


---
~Randy

  reply	other threads:[~2007-10-08 17:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08  7:17 [PATCH] param_sysfs_builtin memchr argument fix Dave Young
2007-10-08 16:13 ` Randy Dunlap [this message]
     [not found]   ` <a8e1da0710081807l74ca63ayf93183eac75193a@mail.gmail.com>
2007-10-09  1:21     ` Dave Young
  -- strict thread matches above, loose matches on Subject: below --
2007-10-08  6:50 Dave Young
2007-10-08  7:02 ` WANG Cong

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=20071008091354.30598ee4.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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