From: WANG Cong <xiyou.wangcong@gmail.com>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: 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 15:02:53 +0800 [thread overview]
Message-ID: <20071008070253.GD2455@hacking> (raw)
In-Reply-To: <20071008065009.GA2862@darkstar.te-china.tietoenator.com>
On Mon, Oct 08, 2007 at 02:50:10PM +0800, Dave Young wrote:
>If memchr argument is longer than strlen(kp->name), there will be some
>weird result.
>
>Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
>
>---
>params.c | 10 ++++++++--
>1 file changed, 8 insertions(+), 2 deletions(-)
Hmm, you used diffstat without -p1?
>
>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 14:31:22.000000000 +0800
>@@ -592,15 +592,21 @@ static void __init param_sysfs_builtin(v
>
> for (i=0; i < __stop___param - __start___param; i++) {
> char *dot;
>+ int kplen;
>
> kp = &__start___param[i];
>+ kplen = strlen(kp->name);
strlen() returns a size_t value, which is unsigned. ;)
>
> /* 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);
>+ continue;
>+ }
>+ dot = memchr(kp->name, '.', kplen);
> if (!dot) {
> DEBUGP("couldn't find period in %s\n", kp->name);
> continue;
>- }
>+ }
You add an extra whitespace in the end of the line.
--
I try to say goodbye and I choke.
I try to walk away and I stumble.
I play it off, but I’m dreaming of you.
Though I try to hide it, it’s clear that
my world crumbles when you are not here.
next prev parent reply other threads:[~2007-10-08 7:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-08 6:50 [PATCH] param_sysfs_builtin memchr argument fix Dave Young
2007-10-08 7:02 ` WANG Cong [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-10-08 7:17 Dave Young
2007-10-08 16:13 ` Randy Dunlap
[not found] ` <a8e1da0710081807l74ca63ayf93183eac75193a@mail.gmail.com>
2007-10-09 1:21 ` Dave Young
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=20071008070253.GD2455@hacking \
--to=xiyou.wangcong@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=hidave.darkstar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.