All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jason Baron <jbaron@akamai.com>, Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH v2 1/2] jump_label: Explicitly disable jump labels in __init code
Date: Sun, 18 Feb 2018 14:15:38 +0100	[thread overview]
Message-ID: <20180218131538.5nmfce2aepcg2bpr@gmail.com> (raw)
In-Reply-To: <20180218130520.3mmosubvt443756v@gmail.com>


* Ingo Molnar <mingo@kernel.org> wrote:

> 2) code robustness 
> 
> For example:
> 
>         for (i = 0; i < 10; i++)
>                 if (foo)
>                         bar(i);
>                 baz(i);
> 
> Is probably buggy code, although technically it's valid syntax and will compile 
> just fine.
> 
> If all multi-line statements have curly braces then this type of bug cannot occur:
> 
>         for (i = 0; i < 10; i++) {
>                 if (foo)
>                         bar(i);
>                 baz(i);
> 	}

Note that newer versions of GCC will warn about this pattern:

     warning: this ‘for’ clause does not guard
              this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’

But the warning is pretty restrictive and GCC won't warn about slightly more 
complex patterns like:

          for (i = 0; i < 10; i++)
                  if (foo)
                          bar(i);
//                debug_fn();
                  baz(i);

Thanks,

	Ingo

  reply	other threads:[~2018-02-18 13:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16 16:31 [PATCH v2 0/2] jump_label: Robustify jump label patching Josh Poimboeuf
2018-02-16 16:31 ` [PATCH v2 1/2] jump_label: Explicitly disable jump labels in __init code Josh Poimboeuf
2018-02-16 16:55   ` Jason Baron
2018-02-16 17:57     ` [PATCH] extable: Make init_kernel_text() global Josh Poimboeuf
2018-02-16 18:03       ` Steven Rostedt
2018-02-17 10:38   ` [PATCH v2 1/2] jump_label: Explicitly disable jump labels in __init code Ingo Molnar
2018-02-17 13:40     ` Josh Poimboeuf
2018-02-17 20:13       ` Thomas Gleixner
2018-02-18 13:05         ` Ingo Molnar
2018-02-18 13:15           ` Ingo Molnar [this message]
2018-02-16 16:31 ` [PATCH v2 2/2] jump_label: Warn on failed jump_label patch Josh Poimboeuf

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=20180218131538.5nmfce2aepcg2bpr@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@suse.de \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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 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.