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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 14 Feb 2008 10:39:04 +0900
From:	Tejun Heo <htejun@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] printk: clean up recursion check related static variables

Make printk_recursion_bug_msg static, drop printk prefix from recurson
variables and move them into vprintk().

Signed-off-by: Tejun Heo <htejun@...il.com>
---
This is slightly modified version of the clean up part.  I don't think
it's wise to pull out all static variables out of functions.  Thanks.

 kernel/printk.c |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

Index: work/kernel/printk.c
===================================================================
--- work.orig/kernel/printk.c
+++ work/kernel/printk.c
@@ -613,15 +613,13 @@ asmlinkage int printk(const char *fmt, .
 	return r;
 }
 
-/* cpu currently holding logbuf_lock */
-static volatile unsigned int printk_cpu = UINT_MAX;
-
-const char printk_recursion_bug_msg [] =
-			KERN_CRIT "BUG: recent printk recursion!\n";
-static int printk_recursion_bug;
-
 asmlinkage int vprintk(const char *fmt, va_list args)
 {
+	/* cpu currently holding logbuf_lock */
+	static volatile unsigned int printk_cpu = UINT_MAX;
+	static const char recursion_bug_msg [] =
+		KERN_CRIT "BUG: recent printk recursion!\n";
+	static int recursion_bug;
 	static int log_level_unknown = 1;
 	static char printk_buf[1024];
 
@@ -649,7 +647,7 @@ asmlinkage int vprintk(const char *fmt, 
 		 * it can be printed at the next appropriate moment:
 		 */
 		if (!oops_in_progress) {
-			printk_recursion_bug = 1;
+			recursion_bug = 1;
 			goto out_restore_irqs;
 		}
 		zap_locks();
@@ -659,10 +657,10 @@ asmlinkage int vprintk(const char *fmt, 
 	spin_lock(&logbuf_lock);
 	printk_cpu = this_cpu;
 
-	if (printk_recursion_bug) {
-		printk_recursion_bug = 0;
-		strcpy(printk_buf, printk_recursion_bug_msg);
-		printed_len = sizeof(printk_recursion_bug_msg);
+	if (recursion_bug) {
+		recursion_bug = 0;
+		strcpy(printk_buf, recursion_bug_msg);
+		printed_len = sizeof(recursion_bug_msg);
 	}
 	/* Emit the output into the temporary buffer */
 	printed_len += vscnprintf(printk_buf + printed_len,
--
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