From: Dave Young <hidave.darkstar@gmail.com>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: linux-kernel@vger.kernel.org, xiyou.wangcong@gmail.com,
akpm@linux-foundation.org, gregkh@suse.de
Subject: Re: [PATCH] param_sysfs_builtin memchr argument fix
Date: Tue, 9 Oct 2007 09:21:11 +0800 [thread overview]
Message-ID: <20071009012111.GA2877@darkstar.te-china.tietoenator.com> (raw)
In-Reply-To: <a8e1da0710081807l74ca63ayf93183eac75193a@mail.gmail.com>
> > 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 ?
Yes, it will casuse duplicate filenames in sysfs. For me, the "nousb"
will cause the "usbcore" created twice.
>
>
> > 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")
Yes, "name" should be added, thanks.
>
> > + continue;
> > + }
> > + dot = memchr(kp->name, '.', kplen);
> > if (!dot) {
> > DEBUGP("couldn't find period in %s\n", kp->name);
> > continue;
> > -
>
Regards
dave
====================================================
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-09 09:16:55.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 name is too long: %s\n", kp->name);
+ continue;
+ }
+ dot = memchr(kp->name, '.', kplen);
if (!dot) {
DEBUGP("couldn't find period in %s\n", kp->name);
continue;
next prev parent reply other threads:[~2007-10-09 1:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- 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=20071009012111.GA2877@darkstar.te-china.tietoenator.com \
--to=hidave.darkstar@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--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
all inboxes | Powered by JetHome®