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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 May 2011 15:53:37 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	joe@...ches.com
Cc:	randy.dunlap@...cle.com, sfr@...b.auug.org.au,
	netdev@...r.kernel.org, linux-next@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: linux-next: Tree for May 24 (ratelimits, CONFIG_PRINTK not
 enabled)

From: Joe Perches <joe@...ches.com>
Date: Tue, 24 May 2011 12:49:40 -0700

> On Tue, 2011-05-24 at 15:32 -0400, David Miller wrote:
>> From: Joe Perches <joe@...ches.com>
>> Date: Tue, 24 May 2011 11:49:48 -0700
>> > On Tue, 2011-05-24 at 11:33 -0700, Randy Dunlap wrote:
>> >> Adding <linux/ratelimit.h> to <asm-generic/bug.h> causes other problems:
>> > Yup, that's not a good solution.
>> Please come up with a fix or I'll have to revert, thanks Joe.
> 
> I have some errands to run for awhile.
> 
> Probably a revert today and another patch set tomorrow
> might be best.
> 
> This seems to work and doesn't cause any extra state to be
> instantiated when !CONFIG_PRINTK.  What do you think?

Seems fine, here it is as a patch.

Randy please test this, thanks:

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 12b250c..9178484 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -162,6 +162,8 @@ extern void warn_slowpath_null(const char *file, const int line);
 	unlikely(__ret_warn_once);				\
 })
 
+#ifdef CONFIG_PRINTK
+
 #define WARN_ON_RATELIMIT(condition, state)			\
 		WARN_ON((condition) && __ratelimit(state))
 
@@ -181,6 +183,25 @@ extern void warn_slowpath_null(const char *file, const int line);
 	__WARN_RATELIMIT(condition, &_rs, format);		\
 })
 
+#else
+
+#define WARN_ON_RATELIMIT(condition, state)			\
+	WARN_ON(condition)
+
+#define __WARN_RATELIMIT(condition, state, format...)		\
+({								\
+	int rtn = WARN(condition, format);			\
+	rtn;							\
+})
+
+#define WARN_RATELIMIT(condition, format...)			\
+({								\
+	int rtn = WARN(condition, format);			\
+	rtn;							\
+})
+
+#endif
+
 /*
  * WARN_ON_SMP() is for cases that the warning is either
  * meaningless for !SMP or may even cause failures.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ