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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20060715010645.GB11515@gondor.apana.org.au>
Date:	Sat, 15 Jul 2006 11:06:45 +1000
From:	Herbert Xu <herbert@...dor.apana.org.au>
To:	Andrew Morton <akpm@...l.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: 2.6.18-rc1-mm2

On Fri, Jul 14, 2006 at 05:35:17PM -0700, Andrew Morton wrote:
>
> Actually, it was added three-odd weeks back.

Oops, I had done a git-read-tree v2.6.17 when tracking down a bug
and forgot to revert to HEAD.

BTW, how about making WARN_ON/WARN_ON_ONCE always return the
condition? That would mean you could do

if (WARN_ON(blah)) {
	handle_impossible_case
}

Rather than

if (unlikely(blah)) {
	WARN_ON(1)
	handle_impossible_case
}

I checked all the newly added WARN_ON_ONCE users and none of them
test the return status so we can still change it.

Signed-off-by: Herbert Xu herbert@...dor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 8ceab7b..7abe5e0 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -16,12 +16,14 @@ #define BUG_ON(condition) do { if (unlik
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
+#define WARN_ON(condition) ({ \
+	int __ret = condition; \
+	if (unlikely(__ret)) { \
 		printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
 		dump_stack(); \
 	} \
-} while (0)
+	unlikely(__ret); \
+})
 #endif
 
 #else /* !CONFIG_BUG */
@@ -41,14 +43,12 @@ #endif
 #define WARN_ON_ONCE(condition)				\
 ({							\
 	static int __warn_once = 1;			\
-	int __ret = 0;					\
+	int __ret = condition;				\
 							\
-	if (unlikely((condition) && __warn_once)) {	\
+	if (WARN_ON(__warn_once && __ret)) {		\
 		__warn_once = 0;			\
-		WARN_ON(1);				\
-		__ret = 1;				\
 	}						\
-	__ret;						\
+	unlikely(__ret);				\
 })
 
 #ifdef CONFIG_SMP
-
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