Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=22800a2830ec07e7cc5c837999890ac47cc7f5de
Commit:     22800a2830ec07e7cc5c837999890ac47cc7f5de
Parent:     9fcc2d15b14894aa53e5e8b7fd5d6e3ca558e5df
Author:     Jan Kiszka <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 14 17:00:08 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Nov 14 18:45:42 2007 -0800

    fix param_sysfs_builtin name length check
    
    Commit faf8c714f4508207a9c81cc94dafc76ed6680b44 caused a regression:
    parameter names longer than MAX_KBUILD_MODNAME will now be rejected,
    although we just need to keep the module name part that short.  This patch
    restores the old behaviour while still avoiding that memchr is called with
    its length parameter larger than the total string length.
    
    Signed-off-by: Jan Kiszka <[EMAIL PROTECTED]>
    Cc: Dave Young <[EMAIL PROTECTED]>
    Cc: Greg KH <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/params.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index 16f269e..2a4c514 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -592,19 +592,16 @@ static void __init param_sysfs_builtin(void)
 
        for (i=0; i < __stop___param - __start___param; i++) {
                char *dot;
-               size_t kplen;
+               size_t max_name_len;
 
                kp = &__start___param[i];
-               kplen = strlen(kp->name);
+               max_name_len =
+                       min_t(size_t, MAX_KBUILD_MODNAME, strlen(kp->name));
 
-               /* We do not handle args without periods. */
-               if (kplen > MAX_KBUILD_MODNAME) {
-                       DEBUGP("kernel parameter name is too long: %s\n", 
kp->name);
-                       continue;
-               }
-               dot = memchr(kp->name, '.', kplen);
+               dot = memchr(kp->name, '.', max_name_len);
                if (!dot) {
-                       DEBUGP("couldn't find period in %s\n", kp->name);
+                       DEBUGP("couldn't find period in first %d characters "
+                              "of %s\n", MAX_KBUILD_MODNAME, kp->name);
                        continue;
                }
                name_len = dot - kp->name;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to