mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Abderrahmane Benbachir <abderrahmane.benbachir@polymtl.ca>
Cc: David Daney <ddaney@caviumnetworks.com>,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	akpm@linux-foundation.org, keescook@chromium.org,
	jeyu@redhat.com, rostedt@goodmis.org, mhocko@suse.com,
	viresh.kumar@linaro.org, thomas.lendacky@amd.com
Subject: Re: [PATCH] init/main.c: check for null pointer before calling initcall
Date: Fri, 27 Oct 2017 21:43:02 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710272139420.1922@nanos> (raw)
In-Reply-To: <20171027185340.Horde.lrfWRcBHRmhKk906QJGixBF@www.imp.polymtl.ca>

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

On Fri, 27 Oct 2017, Abderrahmane Benbachir wrote:
> David Daney <ddaney@caviumnetworks.com> a écrit :
> 
> > On 10/27/2017 11:22 AM, Thomas Gleixner wrote:
> > > On Fri, 27 Oct 2017, David Daney wrote:
> > > 
> > > > On 10/27/2017 09:47 AM, Abderrahmane Benbachir wrote:
> > > > > Simple check to prevent kernel panic when initcall does not exit
> > > > 
> > > > Interesting, under what circumstances do you observe the panic?
> > > > 
> > > > It would be best to include this information in the patch changelog.
> > > 
> > > device_initcall(NULL);
> > > 
> > > might do that, but then it rightfully crashes on boot.
> > > 
> > 
> > That was kind of my point.  The module loader case already checks for a
> > non-NULL pointer, and any NULLs in the in-kernel initializer tables would
> > indicate a bigger problem that should be fixed instead.
> > 
> > David Daney
> 
> But this code can still be written :
> 
> static initcall_t __initcall_mymod \
>   __used __section(".initcall6.init") = NULL;

You can write that, but it's simply wrong and abusing the initcall
system. As I said, the system rightfully crashes.

There are sane ways to do conditional initialization from within a fixed
initcall.

Thanks,

	tglx


      parent reply	other threads:[~2017-10-27 19:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 16:47 Abderrahmane Benbachir
2017-10-27 18:02 ` David Daney
2017-10-27 18:22   ` Thomas Gleixner
2017-10-27 18:26     ` David Daney
2017-10-27 18:53       ` Abderrahmane Benbachir
2017-10-27 18:59         ` David Daney
2017-10-27 19:43         ` Thomas Gleixner [this message]

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=alpine.DEB.2.20.1710272139420.1922@nanos \
    --to=tglx@linutronix.de \
    --cc=abderrahmane.benbachir@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=ddaney@caviumnetworks.com \
    --cc=jeyu@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=thomas.lendacky@amd.com \
    --cc=viresh.kumar@linaro.org \
    /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®