forked from Minki/linux
fix param_sysfs_builtin name length check
Commit faf8c714f4
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 <jan.kiszka@web.de>
Cc: Dave Young <hidave.darkstar@gmail.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9fcc2d15b1
commit
22800a2830
@ -592,19 +592,16 @@ static void __init param_sysfs_builtin(void)
|
|||||||
|
|
||||||
for (i=0; i < __stop___param - __start___param; i++) {
|
for (i=0; i < __stop___param - __start___param; i++) {
|
||||||
char *dot;
|
char *dot;
|
||||||
size_t kplen;
|
size_t max_name_len;
|
||||||
|
|
||||||
kp = &__start___param[i];
|
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. */
|
dot = memchr(kp->name, '.', max_name_len);
|
||||||
if (kplen > MAX_KBUILD_MODNAME) {
|
|
||||||
DEBUGP("kernel parameter name is too long: %s\n", kp->name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
dot = memchr(kp->name, '.', kplen);
|
|
||||||
if (!dot) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
name_len = dot - kp->name;
|
name_len = dot - kp->name;
|
||||||
|
Loading…
Reference in New Issue
Block a user