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]
Date:	Tue, 3 Jul 2012 13:45:11 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Kay Sievers <kay@...y.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: [patch] printk: remove some dead code

Static checkers complain about the impossible condition here.

In 084681d14e ('printk: flush continuation lines immediately to
console'), we changed msg->level from being a u16 to being an unsigned
3 bit bitfield.  That means we can remove the code here to handle log
levels which are in the tens or hundreds column.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

diff --git a/kernel/printk.c b/kernel/printk.c
index 660ba72..3edc531 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -822,15 +822,10 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
 	size_t len = 0;
 
 	if (syslog) {
-		if (buf) {
+		if (buf)
 			len += sprintf(buf, "<%u>", msg->level);
-		} else {
+		else
 			len += 3;
-			if (msg->level > 9)
-				len++;
-			if (msg->level > 99)
-				len++;
-		}
 	}
 
 	len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
--
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