From: Jesper Juhl Fix warning in kernel/module.c::who_is_doing_it() kernel/module.c:1405: warning: ignoring return value of `copy_from_user', declared with attribute warn_unused_result by subtracting copy_from_user return value from 'len' - if we copy less data than we intend there's no point in looping over more than we actually copy. I've also changed the type of 'len' and 'i' from unsigned int to unsigned long since that's the type of mm_struct.arg_start/arg_end and it's also the type of the last argument to copy_from_user. Sure, it'll be promoted and truncated between int/long just fine, but it seems cleaner to me that it's just the same type all the way. I also added an explicit check of the value of 'len' after the calculation of arg_start - arg_end since they are both long values subtracting one from the other could theoretically ield a value larger than 512 and such a value would cause us to overflow our statically allocated array. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton --- 25-akpm/kernel/module.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff -puN kernel/module.c~figure-out-who-is-inserting-bogus-modules-warning-fix kernel/module.c --- 25/kernel/module.c~figure-out-who-is-inserting-bogus-modules-warning-fix 2005-03-13 13:55:23.000000000 -0800 +++ 25-akpm/kernel/module.c 2005-03-13 13:55:23.000000000 -0800 @@ -1400,9 +1400,12 @@ static void who_is_doing_it(void) { /* Print out all the args. */ char args[512]; - unsigned int i, len = current->mm->arg_end - current->mm->arg_start; + unsigned long i, len = current->mm->arg_end - current->mm->arg_start; - copy_from_user(args, (void *)current->mm->arg_start, len); + if (len > 512) + len = 512; + + len -= copy_from_user(args, (void *)current->mm->arg_start, len); for (i = 0; i < len; i++) { if (args[i] == '\0') _