lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1301322956.14261.228.camel@gandalf.stny.rr.com>
Date:	Mon, 28 Mar 2011 10:35:56 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Ingo Molnar <mingo@...e.hu>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH v2][GIT PULL] WARN_ON_SMP(): Add comment to explain ({0;})


Ingo,

As there were conflicts with the first version, I rebased on top of
Linus's latest tree. It's just a comment change so I doubt this would
cause any harm wrt rebasing.

-- Steve

Please pull the latest tip/futex/devel-2 tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-rt.git
tip/futex/devel-2


Steven Rostedt (1):
      WARN_ON_SMP(): Add comment to explain ({0;})

----
 include/asm-generic/bug.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---------------------------
commit ccd0d44fad38dc1bb4b26dcc7a30e9f2c3b36870
Author: Steven Rostedt <srostedt@...hat.com>
Date:   Fri Mar 25 16:21:06 2011 -0400

    WARN_ON_SMP(): Add comment to explain ({0;})
    
    The define to use ({0;}) for the !CONFIG_SMP case of WARN_ON_SMP()
    can be confusing. As the WARN_ON_SMP() needs to be a nop when
    CONFIG_SMP is not set, including all its parameters must not be
    evaluated, and that it must work as both a stand alone statement
    and inside an if condition, we define it to a funky ({0;}).
    
    A simple "0" will not work as it causes gcc to give the warning that
    the statement has no effect.
    
    As this strange definition has raised a few eyebrows from some
    major kernel developers, it is wise to document why we create such
    a work of art.
    
    Cc: Linus Torvalds <torvalds@...ux-foundation.org>
    Cc: Alexey Dobriyan <adobriyan@...il.com>
    Signed-off-by: Steven Rostedt <rostedt@...dmis.org>

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index f2d2faf..e5a3f58 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -194,6 +194,13 @@ extern void warn_slowpath_null(const char *file, const int line);
 #ifdef CONFIG_SMP
 # define WARN_ON_SMP(x)			WARN_ON(x)
 #else
+/*
+ * Use of ({0;}) because WARN_ON_SMP(x) may be used either as
+ * a stand alone line statement or as a condition in an if ()
+ * statement.
+ * A simple "0" would cause gcc to give a "statement has no effect"
+ * warning.
+ */
 # define WARN_ON_SMP(x)			({0;})
 #endif
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ