All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Dobriyan <adobriyan@sw.ru>
Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Whine about suspicious return values from module's ->init() hook
Date: Mon, 4 Feb 2008 13:15:55 -0800	[thread overview]
Message-ID: <20080204131555.d7618a3a.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080204154215.GA26618@localhost.sw.ru>

On Mon, 4 Feb 2008 18:42:15 +0300
Alexey Dobriyan <adobriyan@sw.ru> wrote:

> One head-scratching session could be noticeably shorter with this patch...
> 

Sorry, this is not an adequate description of why you think this patch
should be merged.

> ---
> 
>  kernel/module.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -2171,6 +2171,12 @@ sys_init_module(void __user *umod,
>  		wake_up(&module_wq);
>  		return ret;
>  	}
> +	if (ret > 0) {
> +		printk(KERN_WARNING "%s: '%s'->init suspiciously returned %d\n"
> +		       KERN_WARNING "%s: loading module anyway...\n",
> +		       __func__, mod->name, ret,
> +		       __func__);
> +	}
>  
>  	/* Now it's a first class citizen! */
>  	mutex_lock(&module_mutex);

So we add a debug statement to detect a module init function which returns
positive non-zero values, which module init functions are not supposed to
do.

Fair enough.  But a) the printk could state that more clearly and b) there
should be a comment in the code so that a developer (at whom this patch is
targetted) can go in and find out exactly what he did wrong.


  reply	other threads:[~2008-02-04 21:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-04 15:42 [PATCH] Whine about suspicious return values from module's ->init() hook Alexey Dobriyan
2008-02-04 21:15 ` Andrew Morton [this message]
2008-02-05  3:43 ` Rusty Russell
2008-02-05  3:53   ` Andrew Morton
2008-02-05  6:08     ` Rusty Russell
2008-02-05  6:24       ` Andrew Morton
2008-02-05 22:48         ` Rusty Russell
2008-02-05 23:37           ` Andrew Morton
2008-02-06  6:55             ` Rusty Russell
2008-02-10 22:09               ` [PATCH v2] " Alexey Dobriyan
2008-03-04  3:24                 ` Rusty Russell

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=20080204131555.d7618a3a.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@sw.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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.