mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Abderrahmane Benbachir <abderrahmane.benbachir@polymtl.ca>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	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 11:59:35 -0700	[thread overview]
Message-ID: <72740265-1ea2-ad28-e4e7-518d13e0b4e2@caviumnetworks.com> (raw)
In-Reply-To: <20171027185340.Horde.lrfWRcBHRmhKk906QJGixBF@www.imp.polymtl.ca>

On 10/27/2017 11:53 AM, 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;
> 
> In fact, I'm using the code below to assign at runtime (dynamically) which
> function to be executed or not.
> 

Just use the standard initcall macros pointing to real functions.  If 
you want to do something tricky, put it in your own init function, and 
don't mess with the core kernel code that has been working fine for decades.

David Daney

  reply	other threads:[~2017-10-27 18:59 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 [this message]
2017-10-27 19:43         ` Thomas Gleixner

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=72740265-1ea2-ad28-e4e7-518d13e0b4e2@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=abderrahmane.benbachir@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --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=tglx@linutronix.de \
    --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®