linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: peterz@infradead.org
To: Jules Irenge <jbi.octave@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Frederic Weisbecker <frederic@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alexandre Chartre <alexandre.chartre@oracle.com>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH 4/4] context_tracking: uninitialize static variables
Date: Mon, 3 Aug 2020 11:37:51 +0200	[thread overview]
Message-ID: <20200803093751.GD2674@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200801184603.310769-5-jbi.octave@gmail.com>

On Sat, Aug 01, 2020 at 07:46:03PM +0100, Jules Irenge wrote:
> Checkpatch tool reports an error at a staic variable declaration
> 
> "ERROR: do not initialise statics to false"
> 
> This is due to the fact that this variable is stored in the buffer
> In the .bss section, one can not set an initial value
> Here we can trust the compiler to automatically set them to false.
> The variable has since been uninitialized.
> 
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  kernel/context_tracking.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 36a98c48aedc..21881c534152 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -190,7 +190,7 @@ NOKPROBE_SYMBOL(context_tracking_user_exit);
>  
>  void __init context_tracking_cpu_set(int cpu)
>  {
> -	static __initdata bool initialized = false;
> +	static __initdata bool initialized;

So personally I prefer having the '= false' there. It used to be that
compilers were stupid and would put any initialized static variable in
.data, even if it was initialized with 0. But AFAIK compilers are no
longer that stupid.


  reply	other threads:[~2020-08-03  9:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0/4>
2020-03-30  1:24 ` [PATCH v2 0/4] Coccinelle cleanups Jules Irenge
2020-03-30  1:24   ` [PATCH v2 1/4] cpu: Remove Comparison to bool Jules Irenge
2020-03-30  1:24   ` [PATCH v2 2/4] rcu: Replace 1 by true Jules Irenge
2020-03-30 21:16     ` Paul E. McKenney
2020-03-30  1:24   ` [PATCH v2 3/4] genirq: " Jules Irenge
2020-03-30  1:24   ` [PATCH v2 4/4] locking/rtmutex: Remove Comparison to bool Jules Irenge
2020-03-30 11:21     ` Peter Zijlstra
2020-04-03 16:17       ` Jules Irenge
2020-08-01 18:45 ` [PATCH 0/4] Checkpatch tool errors clean up Jules Irenge
2020-08-01 18:46   ` [PATCH 1/4] acct: Add required space between variable and operator Jules Irenge
2020-08-01 18:46   ` [PATCH 2/4] audit: uninitialize global variable audit_sig_sid Jules Irenge
2020-08-01 18:55     ` Joe Perches
2020-08-01 20:26       ` Paul Moore
2020-08-02 14:32       ` Jules Irenge
2020-08-01 18:46   ` [PATCH 3/4] audit: uninitialize static variables Jules Irenge
2020-08-01 20:21     ` Paul Moore
2020-08-01 18:46   ` [PATCH 4/4] context_tracking: " Jules Irenge
2020-08-03  9:37     ` peterz [this message]
2020-08-03 10:27       ` Jules Irenge
2020-08-01 19:07   ` [PATCH 0/4] Checkpatch tool errors clean up Joe Perches
2020-08-02 14:54     ` Jules Irenge

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=20200803093751.GD2674@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexandre.chartre@oracle.com \
    --cc=frederic@kernel.org \
    --cc=jbi.octave@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).